pub struct RutabagaDescriptor { /* private fields */ }
Expand description
Wraps a RawDescriptor and safely closes it when self falls out of scope.
Implementations§
Source§impl SafeDescriptor
impl SafeDescriptor
Sourcepub fn try_clone(&self) -> Result<SafeDescriptor, Error>
pub fn try_clone(&self) -> Result<SafeDescriptor, Error>
Clones this descriptor, internally creating a new descriptor. The new SafeDescriptor will share the same underlying count within the kernel.
Trait Implementations§
Source§impl AsRawDescriptor for SafeDescriptor
impl AsRawDescriptor for SafeDescriptor
Source§fn as_raw_descriptor(&self) -> i64
fn as_raw_descriptor(&self) -> i64
Source§impl Drop for SafeDescriptor
impl Drop for SafeDescriptor
Source§impl From<File> for SafeDescriptor
impl From<File> for SafeDescriptor
Source§fn from(f: File) -> SafeDescriptor
fn from(f: File) -> SafeDescriptor
Source§impl From<SafeDescriptor> for File
impl From<SafeDescriptor> for File
Source§fn from(_s: SafeDescriptor) -> File
fn from(_s: SafeDescriptor) -> File
Source§impl FromRawDescriptor for SafeDescriptor
impl FromRawDescriptor for SafeDescriptor
Source§unsafe fn from_raw_descriptor(descriptor: i64) -> Self
unsafe fn from_raw_descriptor(descriptor: i64) -> Self
§Safety
Safe only if the caller ensures nothing has access to the descriptor after passing it to
from_raw_descriptor
Source§impl IntoRawDescriptor for SafeDescriptor
impl IntoRawDescriptor for SafeDescriptor
fn into_raw_descriptor(self) -> i64
Source§impl TryFrom<&dyn AsRawDescriptor> for SafeDescriptor
impl TryFrom<&dyn AsRawDescriptor> for SafeDescriptor
Source§fn try_from(rd: &dyn AsRawDescriptor) -> Result<Self, Self::Error>
fn try_from(rd: &dyn AsRawDescriptor) -> Result<Self, Self::Error>
Clones the underlying descriptor (handle), internally creating a new descriptor.
WARNING: Windows does NOT support cloning/duplicating all types of handles. DO NOT use this function on IO completion ports, sockets, or pseudo-handles (except those from GetCurrentProcess or GetCurrentThread). See https://docs.microsoft.com/en-us/windows/win32/api/handleapi/nf-handleapi-duplicatehandle for further details.
TODO(b/191800567): this API has sharp edges on Windows. We should evaluate making some adjustments to smooth those edges.