Struct libnotcurses_sys::NcFile [−][src]
pub struct NcFile { /* fields omitted */ }Expand description
A wrapper struct around
libc::FILE
The notcurses’ FILE type is a transparent
struct, while the equivalent libc’s FILE is an opaque enum.
Several methods are provided to cast back and forth between both types,
in order to allow both rust libc operations and notcurses file operations
over the same underlying *FILE.
Implementations
Intended to be passed into the CFile::open method. It will open the file in a way that will allow reading and writing, including overwriting old data. It will not create the file if it does not exist.
Intended to be passed into the CFile::open method. It will open the file in a way that will allow reading and writing, including overwriting old data
Intended to be passed into the CFile::open method. It will only allow reading.
Intended to be passed into the CFile::open method. It will only allow writing.
Intended to be passed into the CFile::open method. It will only allow data to be appended to the end of the file.
Intended to be passed into the CFile::open method. It will allow data to be appended to the end of the file, and data to be read from the file. It will create the file if it doesn’t exist.
Intended to be passed into the CFile::open method. It will open the file in a way that will allow reading and writing, including overwriting old data. It will create the file if it doesn’t exist
Returns the file pointer in the format expected by the libc crate.
Returns the file pointer in the format expected by notcurses.
Returns the current position in the file.
On error Error::Errno(errno) is returned.
Trait Implementations
Reads exactly the number of bytes required to fill buf.
If the end of the file is reached before buf is filled,
Err(EndOfFile(bytes_read)) will be returned. The data that was read
before that will still have been placed into buf.
Upon some other error, Err(Errno(errno)) will be returned.
Reads the entire file starting from the current_position expanding buf as needed.
On a successful read, this function will return Ok(bytes_read).
If an error occurs during reading, some varient of error will be returned.
Reads the entire file from the beginning and stores it in a string.
On a successful read, this function will return Ok(bytes_read).
If an error occurs during reading, some varient of error will be returned.
Reads exactly the number of bytes required to fill buf.
If the end of the file is reached before buf is filled,
Err(EndOfFile(bytes_read)) will be returned. The data that was read
before that will still have been placed into buf.
Upon some other error, Err(Errno(errno)) will be returned.
Like read, except that it reads into a slice of buffers. Read more
can_vector)Determines if this Reader has an efficient read_vectored
implementation. Read more
read_buf)Pull some bytes from this source into the specified buffer. Read more
read_buf)Read the exact number of bytes required to fill buf. Read more
Creates a “by reference” adaptor for this instance of Read. Read more
Creates an adapter which will chain this stream with another. Read more
Changes the current position in the file using the SeekFrom enum.
To set relative to the beginning of the file (i.e. index is 0 + offset):
SeekFrom::Start(offset)To set relative to the end of the file (i.e. index is file_lenth - 1 - offset):
SeekFrom::End(offset)To set relative to the current position:
SeekFrom::End(offset)On error Error::Errno(errno) is returned.
seek_stream_len)Returns the length of this stream (in bytes). Read more
