File tree 1 file changed +8
-8
lines changed
1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change 1
- struct SimpleQueue < T > {
1
+ pub ( crate ) struct SimpleQueue < T > {
2
2
payload : Vec < T > ,
3
3
pos : usize ,
4
4
}
5
5
6
6
impl < T > SimpleQueue < T > {
7
- fn reserve ( & mut self , n : usize ) {
7
+ pub ( crate ) fn reserve ( & mut self , n : usize ) {
8
8
if n > self . payload . len ( ) {
9
9
self . payload . reserve ( n - self . payload . len ( ) ) ;
10
10
}
11
11
}
12
12
13
- fn size ( & self ) -> usize {
13
+ pub ( crate ) fn size ( & self ) -> usize {
14
14
self . payload . len ( ) - self . pos
15
15
}
16
16
17
- fn empty ( & self ) -> bool {
17
+ pub ( crate ) fn empty ( & self ) -> bool {
18
18
self . pos == self . payload . len ( )
19
19
}
20
20
21
- fn push ( & mut self , t : T ) {
21
+ pub ( crate ) fn push ( & mut self , t : T ) {
22
22
self . payload . push ( t) ;
23
23
}
24
24
25
25
// Do we need mutable version?
26
- fn front ( & self ) -> & T {
26
+ pub ( crate ) fn front ( & self ) -> & T {
27
27
& self . payload [ self . pos ]
28
28
}
29
29
30
- fn clear ( & mut self ) {
30
+ pub ( crate ) fn clear ( & mut self ) {
31
31
self . payload . clear ( ) ;
32
32
self . pos = 0 ;
33
33
}
34
34
35
- fn pop ( & mut self ) {
35
+ pub ( crate ) fn pop ( & mut self ) {
36
36
self . pos += 1 ;
37
37
}
38
38
}
You can’t perform that action at this time.
0 commit comments