File tree 2 files changed +7
-3
lines changed
2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change 2
2
name = " generic-queue"
3
3
version = " 0.1.0"
4
4
authors = [
" You <[email protected] >" ]
5
+ edition = " 2018"
5
6
6
7
[dependencies ]
Original file line number Diff line number Diff line change
1
+ #![ warn( rust_2018_idioms) ]
2
+ #![ allow( elided_lifetimes_in_paths) ]
3
+
1
4
pub struct Queue < T > {
2
5
older : Vec < T > ,
3
6
younger : Vec < T >
4
7
}
5
8
6
9
impl < T > Queue < T > {
7
- pub fn new ( ) -> Queue < T > {
10
+ pub fn new ( ) -> Self {
8
11
Queue { older : Vec :: new ( ) , younger : Vec :: new ( ) }
9
12
}
10
13
@@ -85,6 +88,6 @@ fn test_generic() {
85
88
q. push ( "CAD" ) ; // apparently a Queue<&'static str>
86
89
r. push ( 0.74 ) ; // apparently a Queue<f64>
87
90
88
- q. push ( "BTC" ) ; // Bitcoins per USD, 2017-5
89
- r. push ( 2737.7 ) ; // Rust fails to detect irrational exuberance
91
+ q. push ( "BTC" ) ; // Bitcoins per USD, 2019-6
92
+ r. push ( 13764.0 ) ; // Rust fails to detect irrational exuberance
90
93
}
You can’t perform that action at this time.
0 commit comments