Struct OwnedHandle

Source
pub struct OwnedHandle { /* private fields */ }
Expand description

OwnedHandle allows managing the lifetime of the platform RawFileDescriptor type. It is exposed in the interface of this crate primarily for convenience on Windows where the system handle type is used for a variety of objects that don’t support reading and writing.

Implementations§

Source§

impl OwnedHandle

Source

pub fn new<F: IntoRawFileDescriptor>(f: F) -> Self

Create a new handle from some object that is convertible into the system RawFileDescriptor type. This consumes the parameter and replaces it with an OwnedHandle instance.

Source

pub fn try_clone(&self) -> Result<Self>

Attempt to duplicate the underlying handle and return an OwnedHandle wrapped around the duplicate. Since the duplication requires kernel resources that may not be available, this is a potentially fallible operation. The returned handle has a separate lifetime from the source, but references the same object at the kernel level.

Source

pub fn dup<F: AsRawFileDescriptor>(f: &F) -> Result<Self>

Attempt to duplicate the underlying handle from an object that is representable as the system RawFileDescriptor type and return an OwnedHandle wrapped around the duplicate. Since the duplication requires kernel resources that may not be available, this is a potentially fallible operation. The returned handle has a separate lifetime from the source, but references the same object at the kernel level.

Trait Implementations§

Source§

impl AsRawHandle for OwnedHandle

Source§

fn as_raw_handle(&self) -> RawHandle

Extracts the raw handle. Read more
Source§

impl Debug for OwnedHandle

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for OwnedHandle

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl FromRawHandle for OwnedHandle

Source§

unsafe fn from_raw_handle(handle: RawHandle) -> Self

Constructs a new I/O object from the specified raw handle. Read more
Source§

impl IntoRawHandle for OwnedHandle

Source§

fn into_raw_handle(self) -> RawHandle

Consumes this object, returning the raw underlying handle. Read more
Source§

impl Send for OwnedHandle

Source§

impl Sync for OwnedHandle

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsRawFileDescriptor for T
where T: AsRawHandle,

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRawFileDescriptor for T
where T: FromRawHandle,

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoRawFileDescriptor for T
where T: IntoRawHandle,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.