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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
use alloc::string::String;

use core::str;

use super::super::*;


impl<'a> Collection for &'a str {

    #[inline(always)]
    fn len(&self) -> usize {
        str::len(self)
    }
}


impl Collection for String {

    #[inline(always)]
    fn len(&self) -> usize {
        String::len(self)
    }
}

impl CollectionMut for String {

    #[inline(always)]
    fn clear(&mut self) {
        String::clear(self)
    }
}

impl Create<char> for String {

    #[inline(always)]
    fn create() -> Self { String::new() }
    #[inline(always)]
    fn create_with_capacity(capacity: usize) -> Self { String::with_capacity(capacity) }

    #[inline(always)]
    fn add_element(mut self, ch: char) -> Self {
        String::push(&mut self, ch);
        self
    }
}

impl Insert<usize, char> for String {
    type Output = ();

    #[inline(always)]
    fn insert(&mut self, index: usize, element: char) -> Self::Output {
        String::insert(self, index, element)
    }
}

impl Remove<usize> for String {
    type Output = char;

    #[inline(always)]
    fn remove(&mut self, index: usize) -> Self::Output {
        String::remove(self, index)
    }
}