pub struct File(/* private fields */);
Implementations§
Source§impl File
impl File
Sourcepub const unsafe fn from_raw_fd(fd: RawFd) -> Self
pub const unsafe fn from_raw_fd(fd: RawFd) -> Self
Create a File from a raw fd
§Safety
The fd is valid and is not duplicated.
Duplication is bad since the fd
will be closed when this File
is dropped
Sourcepub fn set_nonblocking(&self) -> Result<()>
pub fn set_nonblocking(&self) -> Result<()>
Set this File
to be non-blocking.
This will result in for example read expecting a certain number of bytes
to fail with EAGAIN
if that data isn’t available.
§Errors
Errors making the underlying syscalls
Trait Implementations§
Source§impl Read for File
impl Read for File
Source§fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>
Reads to the end of this Reader, Read more
Source§fn read_to_string(&mut self, buf: &mut String) -> Result<usize>
fn read_to_string(&mut self, buf: &mut String) -> Result<usize>
Reads to the end of the provided buffer Read more
Source§impl Write for File
impl Write for File
Source§fn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
Tries to write the contents of the provided buffer into this writer
returning how many bytes were written. Read more
Source§fn write_all(&mut self, buf: &[u8]) -> Result<()>
fn write_all(&mut self, buf: &[u8]) -> Result<()>
Writes the full buffer into this
Writer
Read moreAuto Trait Implementations§
impl Freeze for File
impl RefUnwindSafe for File
impl Send for File
impl Sync for File
impl Unpin for File
impl UnwindSafe for File
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more