pub trait SeekInChars {
// Required method
fn seek_in_chars(&mut self, pos: SeekFrom) -> Result<u64>;
// Provided method
fn stream_position_in_chars(&mut self) -> Result<u64> { ... }
}
Expand description
A cursor which can be moved within a stream of characters.
This is same with Seek
except positions are numbered in characters, not in bytes.
Required Methods§
Sourcefn seek_in_chars(&mut self, pos: SeekFrom) -> Result<u64>
fn seek_in_chars(&mut self, pos: SeekFrom) -> Result<u64>
Seek to an offset, in characters, in a stream.
A seek beyond the end of a stream is allowed, but behavior is defined by the implementation.
If the seek operation completed successfully,
this method returns the new position from the start of the stream.
That position can be used later with SeekFrom::Start
.
§Errors
Seeking to a negative offset is considered an error.
Provided Methods§
Sourcefn stream_position_in_chars(&mut self) -> Result<u64>
fn stream_position_in_chars(&mut self) -> Result<u64>
Returns the current seek position from the start of the stream.
This is equivalent to self.seek_in_chars(SeekFrom::Current(0))
.