Struct base::descriptor::Descriptor
source · #[repr(transparent)]pub struct Descriptor(pub RawDescriptor);
Expand description
For use cases where a simple wrapper around a RawDescriptor
is needed, in order to e.g.
implement AsRawDescriptor
.
This is a simply a wrapper and does not manage the lifetime of the descriptor. As such it is the
responsibility of the user to ensure that the wrapped descriptor will not be closed for as long
as the Descriptor
is alive.
Most use-cases should prefer SafeDescriptor
or implementing and using
AsRawDescriptor
on the type providing the descriptor. Using this wrapper usually means
something can be improved in your code.
Valid uses of this struct include:
- You only have a valid
RawDescriptor
and need to pass something that implementsAsRawDescriptor
to a function, - You need to serialize a
RawDescriptor
, - You need
Send
orSync
for your descriptor and properly handle the case where your descriptor gets closed.
Note that with the exception of the last use-case (which requires proper error checking against
the descriptor being closed), the Descriptor
instance would be very short-lived.
Tuple Fields§
§0: RawDescriptor
Trait Implementations§
source§impl AsRawDescriptor for Descriptor
impl AsRawDescriptor for Descriptor
source§fn as_raw_descriptor(&self) -> RawDescriptor
fn as_raw_descriptor(&self) -> RawDescriptor
source§impl AsRawFd for Descriptor
impl AsRawFd for Descriptor
source§impl Clone for Descriptor
impl Clone for Descriptor
source§fn clone(&self) -> Descriptor
fn clone(&self) -> Descriptor
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for Descriptor
impl Debug for Descriptor
source§impl<'de> Deserialize<'de> for Descriptor
impl<'de> Deserialize<'de> for Descriptor
source§fn deserialize<D>(deserializer: D) -> Result<Descriptor, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Descriptor, D::Error>where
D: Deserializer<'de>,
source§impl EventToken for Descriptor
impl EventToken for Descriptor
Implement token for implementations that wish to use this struct as such
source§fn as_raw_token(&self) -> u64
fn as_raw_token(&self) -> u64
from_raw_token
.source§fn from_raw_token(data: u64) -> Self
fn from_raw_token(data: u64) -> Self
as_raw_token
back into a token. Read moresource§impl FromRawDescriptor for Descriptor
impl FromRawDescriptor for Descriptor
source§unsafe fn from_raw_descriptor(desc: RawDescriptor) -> Self
unsafe fn from_raw_descriptor(desc: RawDescriptor) -> Self
source§impl Hash for Descriptor
impl Hash for Descriptor
source§impl Ord for Descriptor
impl Ord for Descriptor
source§fn cmp(&self, other: &Descriptor) -> Ordering
fn cmp(&self, other: &Descriptor) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for Descriptor
impl PartialEq for Descriptor
source§fn eq(&self, other: &Descriptor) -> bool
fn eq(&self, other: &Descriptor) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for Descriptor
impl PartialOrd for Descriptor
source§fn partial_cmp(&self, other: &Descriptor) -> Option<Ordering>
fn partial_cmp(&self, other: &Descriptor) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more