pub trait FromFd {
fn from_fd(owned: OwnedFd) -> Self;
fn from_into_fd<Owned>(into_owned: Owned) -> Self
where
Owned: IntoFd,
Self: Sized,
{ ... }
}
Expand description
A trait to express the ability to construct an object from a file descriptor.
Required Methods§
Provided Methods§
sourcefn from_into_fd<Owned>(into_owned: Owned) -> Selfwhere
Owned: IntoFd,
Self: Sized,
fn from_into_fd<Owned>(into_owned: Owned) -> Selfwhere
Owned: IntoFd,
Self: Sized,
Constructs a new instance of Self
from the given file descriptor
converted from into_owned
.
Example
use std::fs::File;
use io_lifetimes::{FromFd, IntoFd};
let f = File::open("foo.txt")?;
let f = File::from_into_fd(f);