pub trait FromFilelike: FromFd {
    fn from_filelike(owned: OwnedFilelike) -> Self;
fn from_into_filelike<Owned: IntoFilelike>(owned: Owned) -> Self; }
Expand description

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

This is a portability abstraction over Unix-like FromFd and Windows’ FromHandle. It also provides the from_into_filelike convenience function providing simplified from+into conversions.

Required methods

Constructs a new instance of Self from the given filelike object.

Example
use std::fs::File;
use io_lifetimes::{FromFilelike, IntoFilelike, OwnedFilelike};

let f = File::open("foo.txt")?;
let owned_filelike: OwnedFilelike = f.into_filelike();
let f = File::from_filelike(owned_filelike);

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

Example
use std::fs::File;
use io_lifetimes::{FromFilelike, IntoFilelike};

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

Implementors