pub trait StrWrite<'a> {
// Required methods
fn push_str(&'a mut self, s: &'a str);
fn shift_str(&'a mut self, s: &'a str);
}
Expand description
Write/insert operations with &str
-type readers.
Required Methods§
Sourcefn push_str(&'a mut self, s: &'a str)
fn push_str(&'a mut self, s: &'a str)
Insert a &str
into the reader.
The newly inserted &str
will be the last item in the list.
§Examples
let sread = StrReader::default();
sread.push_str("hai");
sread.push_str("bai");
assert_eq!(sread.pop_str(), Some("hai"));
assert_eq!(sread.pop_str(), Some("bai"));
assert_eq!(sread.pop_str(), None);
Sourcefn shift_str(&'a mut self, s: &'a str)
fn shift_str(&'a mut self, s: &'a str)
Insert a &str
into the reader.
The newly inserted &str
will be the next item to be returned.
§Examples
let sread = StrReader::default();
sread.shift_str("hai");
sread.shift_str("bai");
assert_eq!(sread.pop_str(), Some("bai"));
assert_eq!(sread.pop_str(), Some("hai"));
assert_eq!(sread.pop_str(), None);