pub trait Context {
type Data;
type Target: AsFd;
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;
}
Documentation
A trait for data stored within an Epoll instance.
Associated Types
type Data
The type of an element owned by this context.
type Target: AsFd
The type of a value used to refer to an element owned by this context.
Required Methods
fn acquire<'call>(&Self, data: Self::Data) -> Ref<'call, Self::Target>
Assume ownership of data, and returning a Target.
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.
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.
fn release(&Self, target: Ref<'_, Self::Target>) -> Self::Data
Release ownership of the value referred to by target and return it.
Implementors
impl<'a> Context for Borrowing<'a>
type Data = BorrowedFd<'a>type Target = BorrowedFd<'a>fn acquire<'call>(&Self, data: Self::Data) -> Ref<'call, Self::Target>fn encode(&Self, target: Ref<'_, Self::Target>) -> u64unsafe fn decode<'call>(&Self, raw: u64) -> Ref<'call, Self::Target>fn release(&Self, target: Ref<'_, Self::Target>) -> Self::Dataimpl<'context, T: AsFd + IntoFd + FromFd> Context for Owning<'context, T>
type Target = BorrowedFd<'context>fn acquire<'call>(&Self, data: Self::Data) -> Ref<'call, Self::Target>fn encode(&Self, target: Ref<'_, Self::Target>) -> u64unsafe fn decode<'call>(&Self, raw: u64) -> Ref<'call, Self::Target>fn release(&Self, target: Ref<'_, Self::Target>) -> Self::Data