Struct char_device::CharDevice[][src]

#[repr(transparent)]pub struct CharDevice(_);

An unbuffered character device.

This is a wrapper around std::fs::File which is intended for use with character device “files” such as “/dev/tty”.

Implementations

impl CharDevice[src]

pub fn new<Filelike: IntoUnsafeFile + Read + Write>(
    filelike: Filelike
) -> Result<Self>
[src]

Construct a new CharDevice. Fail if the given handle isn’t a valid handle for a character device, or it can’t be determined.

pub fn open<P: AsRef<Path>>(path: P) -> Result<Self>[src]

Construct a new CharDevice from the given filename. Fail if the given handle isn’t a valid handle for a character device, or it can’t be determined.

pub unsafe fn new_unchecked<Filelike: IntoUnsafeFile>(
    filelike: Filelike
) -> Self
[src]

Construct a new CharDevice.

Safety

Doesn’t check that the handle is valid or a character device.

pub fn null() -> Result<Self>[src]

Construct a new CharDevice which discards writes and reads nothing.

This is “/dev/null” on Posix-ish platforms and “nul” on Windows.

pub fn try_clone(&self) -> Result<Self>[src]

Creates a new independently owned handle to the underlying device.

pub fn num_ready_bytes(&self) -> Result<u64>[src]

Return the number of bytes which are ready to be read immediately.

Trait Implementations

impl AsRawHandle for CharDevice[src]

impl AsRawHandleOrSocket for CharDevice[src]

impl Close for CharDevice[src]

impl Debug for CharDevice[src]

impl IntoRawHandle for CharDevice[src]

impl IntoRawHandleOrSocket for CharDevice[src]

impl OwnsRaw for CharDevice[src]

impl Read for CharDevice[src]

impl Write for CharDevice[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> AsUnsafeFile for T where
    T: AsRawHandle + AsUnsafeHandle + OwnsRaw
[src]

impl<T> AsUnsafeHandle for T where
    T: AsRawHandleOrSocket + OwnsRaw
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> IntoUnsafeFile for T where
    T: IntoRawHandle + IntoUnsafeHandle + OwnsRaw
[src]

impl<T> IntoUnsafeHandle for T where
    T: IntoRawHandleOrSocket + OwnsRaw
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.