Struct smithay_client_toolkit::WaylandSource[][src]

pub struct WaylandSource { /* fields omitted */ }

An adapter to insert a Wayland EventQueue into a calloop event loop

This is a struct that implements calloop::EventSource. It generates an event whenever events need to be dispatched. At this point your calloop callback will be given access to the EventQueue and you should call .dispatch_pending() and forward its return value, allowing you to handle orphan events as you prefer.

If you don’t use orphan events, the quick_insert method will firectly insert the source into a provided LoopHandle with an adapter which will panic whenever an oprhan event is encountered.

Implementations

impl WaylandSource[src]

pub fn new(queue: EventQueue) -> WaylandSource[src]

Wrap an EventQueue as a WaylandSource.

pub fn quick_insert<Data: 'static>(
    self,
    handle: LoopHandle<'_, Data>
) -> Result<RegistrationToken, InsertError<WaylandSource>>
[src]

Insert this source into given event loop with an adapter that panics on orphan events

pub fn queue(&mut self) -> &mut EventQueue[src]

Access the underlying event queue

This method can be used if you need to access the underlying EventQueue while this WaylandSource is currently inserted in an event loop.

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 interefere with the proper waking up of this event source in the event loop.

Trait Implementations

impl EventSource for WaylandSource[src]

type Event = ()

The type of events generated by your source.

type Metadata = EventQueue

Some metadata of your event source Read more

type Ret = Result<u32>

The return type of the user callback Read more

fn process_events<F>(
    &mut self,
    _: Readiness,
    _: Token,
    callback: F
) -> Result<()> where
    F: FnMut((), &mut EventQueue) -> Result<u32>, 
[src]

Process any relevant events Read more

fn register(&mut self, poll: &mut Poll, token: Token) -> Result<()>[src]

Register yourself to this poll instance Read more

fn reregister(&mut self, poll: &mut Poll, token: Token) -> Result<()>[src]

Re-register your file descriptors Read more

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

Unregister your file descriptors Read more

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

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]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.