Struct wayland_server::DispatchData
source · [−]pub struct DispatchData<'a> { /* private fields */ }
Expand description
Holder of global dispatch-related data
This struct serves as a dynamic container for the dispatch-time global data that you gave to the dispatch method, and is given as input to all your callbacks. It allows you to share global state between your filters.
The main method of interest is the get
method, which allows you to
access a &mut _
reference to the global data itself. The other methods
are mostly used internally by the crate.
Implementations
sourceimpl<'a> DispatchData<'a>
impl<'a> DispatchData<'a>
sourcepub fn get<T>(&mut self) -> Option<&mut T> where
T: Any,
pub fn get<T>(&mut self) -> Option<&mut T> where
T: Any,
Access the dispatch data knowing its type
Will return None
if the provided type is not the correct
inner type.
sourcepub fn wrap<T>(data: &'a mut T) -> DispatchData<'a> where
T: Any,
pub fn wrap<T>(data: &'a mut T) -> DispatchData<'a> where
T: Any,
Wrap a mutable reference
This creates a new DispatchData
from a mutable reference
sourcepub fn reborrow(&mut self) -> DispatchData<'_>
pub fn reborrow(&mut self) -> DispatchData<'_>
Reborrows this DispatchData
to create a new one with the same content
This is a quick and cheap way to propagate the DispatchData
down a
callback stack by value. It is basically a noop only there to ease
work with the borrow checker.
Trait Implementations
Auto Trait Implementations
impl<'a> !RefUnwindSafe for DispatchData<'a>
impl<'a> !Send for DispatchData<'a>
impl<'a> !Sync for DispatchData<'a>
impl<'a> Unpin for DispatchData<'a>
impl<'a> !UnwindSafe for DispatchData<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
sourcefn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
sourcefn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
sourcefn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
sourcefn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more