mirror of
https://gitlab.com/arnekeller/ascii-table.git
synced 2024-12-04 13:39:06 +00:00
save game
This commit is contained in:
parent
1b7ccc31aa
commit
dd590a9dfb
14
src/lib.rs
14
src/lib.rs
@ -362,20 +362,26 @@ struct SmartString {
|
||||
impl SmartString {
|
||||
|
||||
fn new() -> Self {
|
||||
todo!()
|
||||
Self { fragments: Vec::new() }
|
||||
}
|
||||
|
||||
fn from<T>(string: T) -> Self
|
||||
where T: Display {
|
||||
todo!()
|
||||
// TODO:
|
||||
Self { fragments: vec![(true, string.to_string())] }
|
||||
}
|
||||
|
||||
fn char_len(&self) -> usize {
|
||||
todo!()
|
||||
self.fragments.iter()
|
||||
.filter(|(visible, _)| *visible)
|
||||
.map(|(_, string)| string.chars().count())
|
||||
.sum()
|
||||
}
|
||||
|
||||
fn is_empty(&self) -> bool {
|
||||
todo!()
|
||||
self.fragments.iter()
|
||||
.filter(|(visible, _)| *visible)
|
||||
.all(|(_, string)| string.is_empty())
|
||||
}
|
||||
|
||||
fn pop(&mut self) -> Option<char> {
|
||||
|
Loading…
Reference in New Issue
Block a user