Trait unsafe_io::AsUnsafeHandle[][src]

pub unsafe trait AsUnsafeHandle {
    fn as_unsafe_handle(&self) -> UnsafeHandle;

    fn eq_handle<Handlelike: AsUnsafeHandle>(&self, other: &Handlelike) -> bool { ... }
}
Expand description

A trait for types which contain an unsafe handle and can expose it.

A type implementing AsUnsafeHandle guarantees that the return value from as_unsafe_handle 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

Return the contained unsafe handle.

Provided methods

Test whether self.as_unsafe_handle() is equal to other.as_unsafe_handle().

That this depends on the guarantee that types that implement AsUnsafeHandle own their resources, so we won’t erroneously compare dangling handles.

Implementors