pub struct Owned(/* private fields */);Expand description
An owned opaque value descriptor.
A value of this type encapsulates an opaque value descriptor. Cloning it duplicates the descriptor. Dropping it closes the descriptor. CBOR-encoding it yields an integer with the Identifier tag.
Implementations§
Source§impl Owned
impl Owned
Sourcepub const unsafe fn new(raw: u32) -> Self
pub const unsafe fn new(raw: u32) -> Self
Wraps a raw integer descriptor in a Descriptor object.
§Safety
The caller must ensure that the passed-in value is a valid, open descriptor. Passing a closed descriptor may result in dropping the object closing an unrelated opaque value which happened to be allocated the same descriptor value. Passing an invalid descriptor value may violate the niche requirements and result in undefined behaviour.
The caller must ensure that only one Descriptor object for a given value exists at a
time, because dropping a Descriptor object closes the descriptor.
Sourcepub const fn into_inner(self) -> u32
pub const fn into_inner(self) -> u32
Destroys a Descriptor object and returns the raw value.
The caller must ensure that the descriptor is eventually closed. This function is safe because Rust’s safety guarantees to not include reliable freeing of resources; however, care should be taken when calling it.
Sourcepub fn dup(&self) -> Result<Self>
pub fn dup(&self) -> Result<Self>
Duplicates the descriptor.
§Errors
TooManyDescriptorsis returned if the descriptor table is too full and some descriptors must be closed.