Trait unsafe_io::os::posish::AsRawFd1.0.0[][src]

pub trait AsRawFd {
    pub fn as_raw_fd(&self) -> i32;
}

A trait to extract the raw unix file descriptor from an underlying object.

This is only available on unix platforms and must be imported in order to call the method. Windows platforms have a corresponding AsRawHandle and AsRawSocket set of traits.

Required methods

pub fn as_raw_fd(&self) -> i32[src]

Extracts the raw file descriptor.

This method does not pass ownership of the raw file descriptor to the caller. The descriptor is only guaranteed to be valid while the original object has not yet been destroyed.

Example

use std::fs::File;
use std::os::unix::io::{AsRawFd, RawFd};

let mut f = File::open("foo.txt")?;
// Note that `raw_fd` is only valid as long as `f` exists.
let raw_fd: RawFd = f.as_raw_fd();
Loading content...

Implementations on Foreign Types

impl AsRawFd for UnixListener[src]

impl<'a> AsRawFd for StderrLock<'a>[src]

impl<'a> AsRawFd for StdoutLock<'a>[src]

impl AsRawFd for Stderr[src]

impl AsRawFd for ChildStdout[src]

impl AsRawFd for ChildStderr[src]

impl AsRawFd for UnixDatagram[src]

impl AsRawFd for Stdout[src]

impl AsRawFd for TcpListener[src]

impl AsRawFd for UdpSocket[src]

impl AsRawFd for i32[src]

impl<'a> AsRawFd for StdinLock<'a>[src]

impl AsRawFd for TcpStream[src]

impl AsRawFd for File[src]

impl AsRawFd for Stdin[src]

impl AsRawFd for ChildStdin[src]

impl AsRawFd for UnixStream[src]

Loading content...

Implementors

impl AsRawFd for UnsafeFile[src]

UnsafeFile doesn't own its handle; see the comments for impl AsRawFd for UnsafeHandle.

impl AsRawFd for UnsafeHandle[src]

UnsafeHandle doesn't own its handle, but AsRawFd doesn't require any guarantees about lifetimes, so it's safe to implement. This is similar to how RawFd implements AsRawFd (see the raw_fd_reflexive_traits trait implementations in std).

impl AsRawFd for UnsafeReadable[src]

UnsafeReadable doesn't own its handle; see the comments for impl AsRawFd for UnsafeHandle.

impl AsRawFd for UnsafeSocket[src]

UnsafeSocket doesn't own its handle; see the comments for impl AsRawFd for UnsafeHandle.

impl AsRawFd for UnsafeWriteable[src]

UnsafeWriteable doesn't own its handle; see the comments for impl AsRawFd for UnsafeHandle.

Loading content...