Struct libnotcurses_sys::NcFile [−][src]
pub struct NcFile { /* fields omitted */ }
Expand description
A wrapper struct around
libc::FILE
The notcurses FILE
type FILE_NC
a struct imported through bindgen,
while the equivalent libc
crate FILE
(FILE_LIBC
) 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
NcFile
constructor from a file produced by the libc crate
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 Read
er has an efficient read_vectored
implementation. Read more
read_initializer
)Determines if this Read
er can work with buffers of uninitialized
memory. Read more
Creates a “by reference” adaptor for this instance of Read
. Read more
Creates an adaptor 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_rewind
)Rewind to the beginning of a stream. Read more
seek_stream_len
)Returns the length of this stream (in bytes). Read more