Struct Context

Source
pub struct Context { /* private fields */ }

Implementations§

Source§

impl Context

Source

pub fn new() -> Result<Context>

Examples found in repository?
examples/main.rs (line 6)
5fn main() {
6    let mut ctx = Context::new().unwrap();
7    loop {
8        if let Ok(ev) = ctx.wait_for_event(1000) {
9            println!("{:?}", ev);
10        }
11    }
12}
Source

pub fn wait_for_event_raw_internal(&mut self, timeout_ms: usize) -> Result<&str>

Source

pub fn wait_for_event_raw(&mut self, timeout_ms: usize) -> Result<String>

Waits for an event using poll(), reads it but does not parse

Source

pub fn wait_for_event(&mut self, timeout_ms: usize) -> Result<Event>

Waits for an event using poll(), reads and parses it

Examples found in repository?
examples/main.rs (line 8)
5fn main() {
6    let mut ctx = Context::new().unwrap();
7    loop {
8        if let Ok(ev) = ctx.wait_for_event(1000) {
9            println!("{:?}", ev);
10        }
11    }
12}
Source

pub fn fd(&self) -> RawFd

Returns the devd socket file descriptor in case you want to select/poll on it together with other file descriptors

Source

pub fn read_event(&mut self) -> Result<Event>

Reads an event and parses it. Use when polling on the raw fd by yourself

Trait Implementations§

Source§

impl Debug for Context

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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.