Trait unsafe_io::AsUnsafeFile [−][src]
A trait for types which contain an unsafe file and can expose it.
A type implementing AsUnsafeFile
guarantees that the return value
from as_unsafe_file
on an instance of the type is a copy of a handle
which is owned.
Safety
This trait is unsafe
because types implementing it must guarantee they
own their handle.
Required methods
fn as_unsafe_file(&self) -> UnsafeFile
[src]
Return the contained unsafe file.
Provided methods
fn as_file_view(&self) -> View<'_, File>
[src]
Utility for returning a value which dereferences to a &File
or
&mut File
.
Note that AsUnsafeFile
may be implemented for types which are not
normal files, and which don't support all the methods on File
.
unsafe fn as_unscoped_file_view(&self) -> View<'static, File>
[src]
Like as_file_view
, but returns a value which is not explicitly tied
to the lifetime of self
.
Safety
Callers must manually ensure that the view doesn't outlive self
.
fn eq_file<Filelike: AsUnsafeFile>(&self, other: &Filelike) -> bool
[src]
Test whether self.as_unsafe_file().as_unsafe_handle()
is equal to
other.as_unsafe_file().as_unsafe_handle()
.
That this depends on the guarantee that types that implement
AsUnsafeFile
own their resources, so we won't erroneously compare
dangling handles.