pub trait FromHandle {
    fn from_handle(owned: OwnedHandle) -> Self;

    fn from_into_handle<Owned: IntoHandle>(into_owned: Owned) -> Self
    where
        Self: Sized
, { ... } }
Expand description

A trait to express the ability to construct an object from a handle.

Required methods

Constructs a new instance of Self from the given handle.

Example
use std::fs::File;
use io_lifetimes::{FromHandle, IntoHandle, OwnedHandle};

let f = File::open("foo.txt")?;
let owned_handle: OwnedHandle = f.into_handle();
let f = File::from_handle(owned_handle);

Provided methods

Constructs a new instance of Self from the given handle converted from into_owned.

Example
use std::fs::File;
use io_lifetimes::{FromHandle, IntoHandle};

let f = File::open("foo.txt")?;
let f = File::from_into_handle(f);

Implementations on Foreign Types

Implementors