Struct wayland_commons::filter::DispatchData [−][src]
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
impl<'a> DispatchData<'a>
[src]
pub fn get<T: Any>(&mut self) -> Option<&mut T>
[src]
Access the dispatch data knowing its type
Will return None
if the provided type is not the correct
inner type.
pub fn wrap<T: Any>(data: &'a mut T) -> DispatchData<'a>
[src]
Wrap a mutable reference
This creates a new DispatchData
from a mutable reference
pub fn reborrow(&mut self) -> DispatchData<'_>
[src]
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.
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
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,