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;
}Expand description
A trait for data stored within an Epoll instance.
Required Associated Types
Required Methods
Assume ownership of data, and returning a Target.
Encode target as a u64. The only requirement on this value is that
it be decodable by decode.
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.