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

    // Provided method
    fn from_into_handle<Owned: Into<OwnedHandle>>(into_owned: Owned) -> Self
       where Self: Sized + From<OwnedHandle> { ... }
}
Expand description

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

Required Methods§

source

fn from_handle(owned: OwnedHandle) -> Self

👎Deprecated since 1.0.0: FromHandle::from_handle is replaced by From<OwnedHandle>::from

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§

source

fn from_into_handle<Owned: Into<OwnedHandle>>(into_owned: Owned) -> Selfwhere Self: Sized + From<OwnedHandle>,

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);

Implementors§