Trait rustix::io::epoll::Context

source ·
pub trait Context {
    type Data;
    type Target: AsFd;

    // Required methods
    fn acquire<'call>(&self, data: Self::Data) -> Ref<'call, Self::Target>;
    fn encode(&self, target: Ref<'_, Self::Target>) -> u64;
    unsafe fn decode<'call>(&self, raw: u64) -> Ref<'call, Self::Target>;
    fn release(&self, target: Ref<'_, Self::Target>) -> Self::Data;
}
Expand description

A trait for data stored within an Epoll instance.

Required Associated Types§

source

type Data

The type of an element owned by this context.

source

type Target: AsFd

The type of a value used to refer to an element owned by this context.

Required Methods§

source

fn acquire<'call>(&self, data: Self::Data) -> Ref<'call, Self::Target>

Assume ownership of data, and returning a Target.

source

fn encode(&self, target: Ref<'_, Self::Target>) -> u64

Encode target as a u64. The only requirement on this value is that it be decodable by decode.

source

unsafe fn decode<'call>(&self, raw: u64) -> Ref<'call, Self::Target>

Decode raw, which is a value encoded by encode, into a Target.

Safety

raw must be a u64 value returned from encode, from the same context, and within the context’s lifetime.

source

fn release(&self, target: Ref<'_, Self::Target>) -> Self::Data

Release ownership of the value referred to by target and return it.

Implementors§

source§

impl<'a> Context for Borrowing<'a>

§

type Data = BorrowedFd<'a>

§

type Target = BorrowedFd<'a>

source§

impl<'context, T: AsFd + Into<OwnedFd> + From<OwnedFd>> Context for Owning<'context, T>

§

type Data = T

§

type Target = BorrowedFd<'context>