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

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.

Closes the stream.

Returns

0 on success or %-1 on fail.

Initializes a new stream with bounds start and end.

start

start boundary

end

end boundary

Tests the end-of-stream indicator for self.

Returns

true on EOS or false otherwise.

Sync's the stream to disk.

Returns

0 on success or %-1 on fail.

Gets the length of the stream.

Returns

the length of the stream or %-1 if unknown.

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.

Resets the stream.

Returns

0 on success or %-1 on fail.

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.

Set the bounds on a stream.

start

start boundary

end

end boundary

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.

Gets the current offset within the stream.

Returns

the current position within the stream or %-1 on fail.

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.

Writes string to self.

str

string to write

Returns

the number of bytes written or %-1 on fail.

Attempts to write the source stream to the destination stream.

dest

destination stream

Returns

the number of bytes written or %-1 on fail.

Implementors