Struct wayland_server::Main
source · [−]Expand description
A main handle to a proxy
Implementations
sourceimpl<I: Interface> Main<I> where
I: AsRef<Resource<I>> + From<Resource<I>>,
impl<I: Interface> Main<I> where
I: AsRef<Resource<I>> + From<Resource<I>>,
sourcepub fn assign<E>(&self, filter: Filter<E>) where
I: AsRef<Resource<I>> + From<Resource<I>>,
E: From<(Main<I>, I::Request)> + 'static,
I::Request: MessageGroup<Map = ResourceMap>,
pub fn assign<E>(&self, filter: Filter<E>) where
I: AsRef<Resource<I>> + From<Resource<I>>,
E: From<(Main<I>, I::Request)> + 'static,
I::Request: MessageGroup<Map = ResourceMap>,
Assign this object to given filter
All future requests received by this object will be delivered to this filter.
An object that is not assigned to any filter will see trigger a protocol error and kill its client signalling a server bug if it receives a request.
Message type of the filter should verify
E: From<(Main<I>, I::Request)>
. See the request_enum!
macro provided
in this library to easily generate appropriate types.
sourcepub fn quick_assign<F>(&self, f: F) where
I: Interface + AsRef<Resource<I>> + From<Resource<I>>,
F: FnMut(Main<I>, I::Request, DispatchData<'_>) + 'static,
I::Request: MessageGroup<Map = ResourceMap>,
pub fn quick_assign<F>(&self, f: F) where
I: Interface + AsRef<Resource<I>> + From<Resource<I>>,
F: FnMut(Main<I>, I::Request, DispatchData<'_>) + 'static,
I::Request: MessageGroup<Map = ResourceMap>,
Shorthand for assigning a closure to an object
Behaves similarly as assign(..)
, but is a shorthand if
you want to assign this object to its own filter. In which
case you just need to provide the appropriate closure, of
type FnMut(Main<I>, I::Event)
.
sourcepub fn assign_destructor<E>(&self, filter: Filter<E>) where
I: AsRef<Resource<I>> + From<Resource<I>>,
E: From<Resource<I>> + 'static,
pub fn assign_destructor<E>(&self, filter: Filter<E>) where
I: AsRef<Resource<I>> + From<Resource<I>>,
E: From<Resource<I>> + 'static,
Assign a destructor to this object
The filter will be called upon destruction of this object
with a payload of type Resource<I>
.
sourcepub unsafe fn init_from_c_ptr(_ptr: *mut wl_resource) -> Self
pub unsafe fn init_from_c_ptr(_ptr: *mut wl_resource) -> Self
Create a Main
instance from a C pointer to a new object
Create a Main
from a raw pointer to a wayland object from the
C library by taking control of it.
In order to handle protocol races, invoking it with a NULL pointer will create an already-dead object.
NOTE: This method will panic if called while the use_system_lib
feature is not
activated
Safety
The provided pointer must be a valid pointer to a wayland object from
libwayland-client
associated to the correct interface.
You must ensure that this object was newly created and have never been user nor had any listener associated.
Trait Implementations
sourceimpl<I: PartialEq + Interface + AsRef<Resource<I>> + From<Resource<I>>> PartialEq<Main<I>> for Main<I>
impl<I: PartialEq + Interface + AsRef<Resource<I>> + From<Resource<I>>> PartialEq<Main<I>> for Main<I>
impl<I: Interface + AsRef<Resource<I>> + From<Resource<I>>> StructuralPartialEq for Main<I>
Auto Trait Implementations
impl<I> RefUnwindSafe for Main<I> where
I: RefUnwindSafe,
impl<I> !Send for Main<I>
impl<I> !Sync for Main<I>
impl<I> Unpin for Main<I> where
I: Unpin,
impl<I> UnwindSafe for Main<I> where
I: UnwindSafe,
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