pub struct WaylandSource<D> { /* private fields */ }
Available on crate feature 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>

source

pub fn new(queue: EventQueue<D>) -> Result<WaylandSource<D>, WaylandError>

Wrap an EventQueue as a WaylandSource.

source

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.

source

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>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<D> EventSource for WaylandSource<D>

§

type Metadata = EventQueue<D>

The underlying event queue.

You should call EventQueue::dispatch_pending inside your callback using this queue.

§

type Event = ()

The type of events generated by your source.
§

type Ret = Result<usize, DispatchError>

The return type of the user callback Read more
§

type Error = Error

The error type returned from 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,

Process any relevant events Read more
source§

fn register( &mut self, poll: &mut Poll, token_factory: &mut TokenFactory ) -> Result<()>

Register yourself to this poll instance Read more
source§

fn reregister( &mut self, poll: &mut Poll, token_factory: &mut TokenFactory ) -> Result<()>

Re-register your file descriptors Read more
source§

fn unregister(&mut self, poll: &mut Poll) -> Result<()>

Unregister your file descriptors Read more
source§

fn pre_run<F>(&mut self, callback: F) -> Result<()>where F: FnMut((), &mut Self::Metadata) -> Self::Ret,

Notification that a polling session is going to start Read more
source§

fn post_run<F>(&mut self, _: F) -> Result<()>where F: FnMut((), &mut Self::Metadata) -> Self::Ret,

Notification that the current polling session ended Read more

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast for Twhere T: Any,

§

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.
§

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.
§

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.
§

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.
§

impl<T> DowncastSync for Twhere T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync + 'static>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.