Trait StringWrite

Source
pub trait StringWrite {
    // Required methods
    fn push_string(&mut self, s: String);
    fn shift_string(&mut self, s: String);
}
Expand description

Write/insert operations with String-type readers.

Required Methods§

Source

fn push_string(&mut self, s: String)

Insert a String into the reader.

The newly inserted String will be the last item in the list.

§Examples
let sread = StringReader::default();
sread.push_string("hai".to_string());
sread.push_string("bai".to_string());
assert_eq!(sread.pop_string(), Some("hai".to_string()));
assert_eq!(sread.pop_string(), Some("bai".to_string()));
assert_eq!(sread.pop_string(), None);
Source

fn shift_string(&mut self, s: String)

Insert a String into the reader.

The newly inserted String will be the last item in the list.

§Examples
let sread = StringReader::default();
sread.shift_string("hai".to_string());
sread.shift_string"bai".to_string());
assert_eq!(sread.pop_string(), Some("bai".to_string()));
assert_eq!(sread.pop_string(), Some("hai".to_string()));
assert_eq!(sread.pop_string(), None);

Implementors§