Trait wayland_backend::rs::server_impl::handle::ErasedState
source · pub(crate) trait ErasedState: Downcast {
Show 14 methods
// Required methods
fn object_info(&self, id: InnerObjectId) -> Result<ObjectInfo, InvalidId>;
fn insert_client(
&mut self,
stream: UnixStream,
data: Arc<dyn ClientData>,
) -> Result<InnerClientId>;
fn get_client(&self, id: InnerObjectId) -> Result<ClientId, InvalidId>;
fn get_client_data(
&self,
id: InnerClientId,
) -> Result<Arc<dyn ClientData>, InvalidId>;
fn get_client_credentials(
&self,
id: InnerClientId,
) -> Result<Credentials, InvalidId>;
fn with_all_clients(&self, f: &mut dyn FnMut(ClientId));
fn with_all_objects_for(
&self,
client_id: InnerClientId,
f: &mut dyn FnMut(ObjectId),
) -> Result<(), InvalidId>;
fn object_for_protocol_id(
&self,
client_id: InnerClientId,
interface: &'static Interface,
protocol_id: u32,
) -> Result<ObjectId, InvalidId>;
fn get_object_data_any(
&self,
id: InnerObjectId,
) -> Result<Arc<dyn Any + Send + Sync>, InvalidId>;
fn send_event(
&mut self,
msg: Message<ObjectId, RawFd>,
) -> Result<(), InvalidId>;
fn post_error(
&mut self,
object_id: InnerObjectId,
error_code: u32,
message: CString,
);
fn kill_client(
&mut self,
client_id: InnerClientId,
reason: DisconnectReason,
);
fn global_info(&self, id: InnerGlobalId) -> Result<GlobalInfo, InvalidId>;
fn flush(&mut self, client: Option<ClientId>) -> Result<()>;
}
Required Methods§
fn object_info(&self, id: InnerObjectId) -> Result<ObjectInfo, InvalidId>
fn insert_client( &mut self, stream: UnixStream, data: Arc<dyn ClientData>, ) -> Result<InnerClientId>
fn get_client(&self, id: InnerObjectId) -> Result<ClientId, InvalidId>
fn get_client_data( &self, id: InnerClientId, ) -> Result<Arc<dyn ClientData>, InvalidId>
fn get_client_credentials( &self, id: InnerClientId, ) -> Result<Credentials, InvalidId>
fn with_all_clients(&self, f: &mut dyn FnMut(ClientId))
fn with_all_objects_for( &self, client_id: InnerClientId, f: &mut dyn FnMut(ObjectId), ) -> Result<(), InvalidId>
fn object_for_protocol_id( &self, client_id: InnerClientId, interface: &'static Interface, protocol_id: u32, ) -> Result<ObjectId, InvalidId>
fn get_object_data_any( &self, id: InnerObjectId, ) -> Result<Arc<dyn Any + Send + Sync>, InvalidId>
fn send_event(&mut self, msg: Message<ObjectId, RawFd>) -> Result<(), InvalidId>
fn post_error( &mut self, object_id: InnerObjectId, error_code: u32, message: CString, )
fn kill_client(&mut self, client_id: InnerClientId, reason: DisconnectReason)
fn global_info(&self, id: InnerGlobalId) -> Result<GlobalInfo, InvalidId>
fn flush(&mut self, client: Option<ClientId>) -> Result<()>
Implementations§
source§impl dyn ErasedState
impl dyn ErasedState
sourcepub fn is<__T: ErasedState>(&self) -> bool
pub fn is<__T: ErasedState>(&self) -> bool
Returns true if the trait object wraps an object of type __T
.
sourcepub fn downcast<__T: ErasedState>(
self: Box<Self>,
) -> Result<Box<__T>, Box<Self>>
pub fn downcast<__T: ErasedState>( self: Box<Self>, ) -> Result<Box<__T>, Box<Self>>
Returns a boxed object from a boxed trait object if the underlying object is of type
__T
. Returns the original boxed trait if it isn’t.
sourcepub fn downcast_rc<__T: ErasedState>(
self: Rc<Self>,
) -> Result<Rc<__T>, Rc<Self>>
pub fn downcast_rc<__T: ErasedState>( self: Rc<Self>, ) -> Result<Rc<__T>, Rc<Self>>
Returns an Rc
-ed object from an Rc
-ed trait object if the underlying object is of
type __T
. Returns the original Rc
-ed trait if it isn’t.
sourcepub fn downcast_ref<__T: ErasedState>(&self) -> Option<&__T>
pub fn downcast_ref<__T: ErasedState>(&self) -> Option<&__T>
Returns a reference to the object within the trait object if it is of type __T
, or
None
if it isn’t.
sourcepub fn downcast_mut<__T: ErasedState>(&mut self) -> Option<&mut __T>
pub fn downcast_mut<__T: ErasedState>(&mut self) -> Option<&mut __T>
Returns a mutable reference to the object within the trait object if it is of type
__T
, or None
if it isn’t.