Trait gmime::StreamExt [−][src]
pub trait StreamExt { fn buffer_gets(&self, buf: &str, max: usize) -> isize; fn close(&self) -> i32; fn construct(&self, start: i64, end: i64); fn eos(&self) -> bool; fn flush(&self) -> i32; fn length(&self) -> i64; fn read(&self, buf: &[u8]) -> isize; fn reset(&self) -> i32; fn seek(&self, offset: i64, whence: SeekWhence) -> i64; fn set_bounds(&self, start: i64, end: i64); fn substream(&self, start: i64, end: i64) -> Option<Stream>; fn tell(&self) -> i64; fn write(&self, buf: &str) -> isize; fn write_string(&self, str: &str) -> isize; fn write_to_stream<P: IsA<Stream>>(&self, dest: &P) -> i64; }
Trait containing all Stream
methods.
Implementors
StreamBuffer
, StreamCat
, StreamFile
, StreamFilter
, StreamFs
, StreamGIO
, StreamMem
, StreamMmap
, StreamNull
, StreamPipe
, Stream
Required Methods
fn buffer_gets(&self, buf: &str, max: usize) -> isize
Reads in at most one less than max
characters from self
and
stores them into the buffer pointed to by buf
. Reading stops after
an EOS or newline ('\n'). If a newline is read, it is stored into
the buffer. A '\0' is stored after the last character in the
buffer.
buf
line buffer
max
max length of a line
Returns
the number of characters read into buf
on success or %-1
on fail.
fn close(&self) -> i32
fn construct(&self, start: i64, end: i64)
fn eos(&self) -> bool
fn flush(&self) -> i32
fn length(&self) -> i64
fn read(&self, buf: &[u8]) -> isize
Attempts to read up to len
bytes from self
into buf
.
buf
buffer
len
buffer length
Returns
the number of bytes read or %-1 on fail.
fn reset(&self) -> i32
fn seek(&self, offset: i64, whence: SeekWhence) -> i64
Repositions the offset of the stream self
to
the argument offset
according to the
directive whence
as follows:
SeekWhence::Set
: Seek offset
bytes relative to
the beginning (bound_start) of the stream.
SeekWhence::Cur
: Seek offset
bytes relative to the
current offset of the stream.
SeekWhence::End
: Seek offset
bytes relative to the
end of the stream (bound_end if non-negative).
offset
positional offset
whence
seek directive
Returns
the resultant position on success or %-1 on fail.
fn set_bounds(&self, start: i64, end: i64)
fn substream(&self, start: i64, end: i64) -> Option<Stream>
Creates a new substream of self
with bounds start
and end
.
start
start boundary
end
end boundary
Returns
a substream of self
with bounds start
and end
.
fn tell(&self) -> i64
Gets the current offset within the stream.
Returns
the current position within the stream or %-1 on fail.
fn write(&self, buf: &str) -> isize
Attempts to write up to len
bytes of buf
to self
.
buf
buffer
len
buffer length
Returns
the number of bytes written or %-1 on fail.
fn write_string(&self, str: &str) -> isize
fn write_to_stream<P: IsA<Stream>>(&self, dest: &P) -> i64
Implementors
impl<O: IsA<Stream>> StreamExt for O