Struct wayland_client::WaylandSource
source · pub struct WaylandSource<D> { /* private fields */ }
calloop
only.Expand description
An adapter to insert an EventQueue
into a calloop EventLoop
.
This type implements EventSource
which generates an event whenever events on the event queue need to be
dispatched. The event queue available in the callback calloop registers may be used to dispatch pending
events using EventQueue::dispatch_pending
.
WaylandSource::insert
can be used to insert this source into an event loop and automatically dispatch
pending events on the event queue.
Implementations§
source§impl<D> WaylandSource<D>
impl<D> WaylandSource<D>
sourcepub fn new(queue: EventQueue<D>) -> Result<WaylandSource<D>, WaylandError>
pub fn new(queue: EventQueue<D>) -> Result<WaylandSource<D>, WaylandError>
Wrap an EventQueue
as a WaylandSource
.
sourcepub fn queue(&mut self) -> &mut EventQueue<D>
pub fn queue(&mut self) -> &mut EventQueue<D>
Access the underlying event queue
Note that you should be careful when interacting with it if you invoke methods that
interact with the wayland socket (such as dispatch()
or prepare_read()
). These may
interfere with the proper waking up of this event source in the event loop.
sourcepub fn insert(
self,
handle: LoopHandle<'_, D>
) -> Result<RegistrationToken, InsertError<Self>>where
D: 'static,
pub fn insert( self, handle: LoopHandle<'_, D> ) -> Result<RegistrationToken, InsertError<Self>>where D: 'static,
Insert this source into the given event loop.
This adapter will pass the event loop’s shared data as the D
type for the event loop.
Trait Implementations§
source§impl<D: Debug> Debug for WaylandSource<D>
impl<D: Debug> Debug for WaylandSource<D>
source§impl<D> EventSource for WaylandSource<D>
impl<D> EventSource for WaylandSource<D>
§type Metadata = EventQueue<D>
type Metadata = EventQueue<D>
The underlying event queue.
You should call EventQueue::dispatch_pending
inside your callback using this queue.
§type Error = Error
type Error = Error
process_events()
(not the user callback!).source§fn process_events<F>(
&mut self,
readiness: Readiness,
token: Token,
callback: F
) -> Result<PostAction, Self::Error>where
F: FnMut(Self::Event, &mut Self::Metadata) -> Self::Ret,
fn process_events<F>( &mut self, readiness: Readiness, token: Token, callback: F ) -> Result<PostAction, Self::Error>where F: FnMut(Self::Event, &mut Self::Metadata) -> Self::Ret,
source§fn register(
&mut self,
poll: &mut Poll,
token_factory: &mut TokenFactory
) -> Result<()>
fn register( &mut self, poll: &mut Poll, token_factory: &mut TokenFactory ) -> Result<()>
source§fn reregister(
&mut self,
poll: &mut Poll,
token_factory: &mut TokenFactory
) -> Result<()>
fn reregister( &mut self, poll: &mut Poll, token_factory: &mut TokenFactory ) -> Result<()>
source§fn unregister(&mut self, poll: &mut Poll) -> Result<()>
fn unregister(&mut self, poll: &mut Poll) -> Result<()>
Auto Trait Implementations§
impl<D> !RefUnwindSafe for WaylandSource<D>
impl<D> Send for WaylandSource<D>
impl<D> Sync for WaylandSource<D>
impl<D> Unpin for WaylandSource<D>
impl<D> !UnwindSafe for WaylandSource<D>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
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
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.