[go: up one dir, main page]

reis::ei::connection

Enum Event

source
#[non_exhaustive]
pub enum Event { Disconnected { last_serial: u32, reason: DisconnectReason, explanation: String, }, Seat { seat: Seat, }, InvalidObject { last_serial: u32, invalid_id: u64, }, Ping { ping: Pingpong, }, }

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Disconnected

This event may be sent by the EIS implementation immediately before the client is disconnected. The last_serial argument is set to the last serial number used in a request by the client or zero if the client has not yet issued a request.

Where a client is disconnected by EIS on purpose, for example after a user interaction, the reason is disconnect_reason.disconnected (i.e. zero) and the explanation is NULL.

Where a client is disconnected due to some invalid request or other protocol error, the reason is one of disconnect_reason (i.e. nonzero) and explanation may contain a string explaining why. This string is intended to help debugging only and is not guaranteed to stay constant.

The ei_connection object will be destroyed by the EIS implementation immediately after this event has been sent, a client must not attempt to use it after that point.

There is no guarantee this event is sent - the connection may be closed without a disconnection event.

Fields

§last_serial: u32

the last serial sent by the EIS implementation

§reason: DisconnectReason

the reason for being disconnected

§explanation: String

an explanation for debugging purposes

§

Seat

Notification that a new seat has been added.

A seat is a set of input devices that logically belong together.

This event is only sent if the client announced support for the “ei_seat” interface in ei_handshake.interface_version. The interface version is equal or less to the client-supported version in ei_handshake.interface_version for the “ei_seat” interface.

Fields

§seat: Seat
§

InvalidObject

Notification that an object ID used in an earlier request was invalid and does not exist.

This event is sent by the EIS implementation when an object that does not exist as seen by the EIS implementation. The protocol is asynchronous and this may occur e.g. when the EIS implementation destroys an object at the same time as the client requests functionality from that object. For example, an EIS implementation may send ei_device.destroyed and destroy the device’s resources (and protocol object) at the same time as the client attempts to ei_device.start_emulating on that object.

It is the client’s responsibilty to unwind any state changes done to the object since the last successful message.

Fields

§last_serial: u32

the last serial sent by the EIS implementation

§invalid_id: u64
§

Ping

The ping event asks the client to emit the ‘done’ event on the provided ei_pingpong object. Since requests are handled in-order and events are delivered in-order, this can be used as a synchronization point to ensure all previous requests and the resulting events have been handled.

The object returned by this request must be destroyed by the ei client implementation after the callback is fired and as such the client must not attempt to use it after that point.

The callback_data in the resulting ei_pingpong.done request is ignored by the EIS implementation.

Note that for a EIS implementation to use this request the client must announce support for this interface in ei_handshake.interface_version. It is a protocol violation to send this event to a client without the “ei_pingpong” interface.

Fields

§ping: Pingpong

callback object for the ping request

Trait Implementations§

source§

impl Debug for Event

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Event

§

impl RefUnwindSafe for Event

§

impl Send for Event

§

impl Sync for Event

§

impl Unpin for Event

§

impl UnwindSafe for Event

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where 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 T
where U: Into<T>,

source§

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 T
where U: TryFrom<T>,

source§

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.