1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
pub trait Str {
fn inc(self, c:char) -> Self;
fn dec(self) -> Self;
fn plus(self, s:&str) -> Self;
fn zero(self) -> Self;
fn shrink(self) -> Self;
}
impl Str for String {
fn inc(mut self, c:char) -> Self
{ self.push(c); self }
fn dec(mut self) -> Self
{ self.pop(); self }
fn plus(mut self, s:&str) -> Self
{ self.push_str(s); self}
fn zero(mut self) -> Self
{ self.clear(); self }
fn shrink(mut self) -> Self
{ self.shrink_to_fit(); self }
}