File tree 4 files changed +10
-9
lines changed
4 files changed +10
-9
lines changed Original file line number Diff line number Diff line change 5
5
6
6
// I AM NOT DONE
7
7
8
- // Obtain the number of bytes (not characters) in the given argument
9
- // Add the AsRef trait appropriately as a trait bound
8
+ // Obtain the number of bytes (not characters) in the given argument.
9
+ // TODO: Add the AsRef trait appropriately as a trait bound.
10
10
fn byte_counter < T > ( arg : T ) -> usize {
11
11
arg. as_ref ( ) . as_bytes ( ) . len ( )
12
12
}
13
13
14
- // Obtain the number of characters (not bytes) in the given argument
15
- // Add the AsRef trait appropriately as a trait bound
14
+ // Obtain the number of characters (not bytes) in the given argument.
15
+ // TODO: Add the AsRef trait appropriately as a trait bound.
16
16
fn char_counter < T > ( arg : T ) -> usize {
17
17
arg. as_ref ( ) . chars ( ) . count ( )
18
18
}
19
19
20
- // Squares a number using as_mut(). Add the trait bound as is appropriate and
21
- // implement the function body .
20
+ // Squares a number using as_mut().
21
+ // TODO: Add the appropriate trait bound .
22
22
fn num_sq < T > ( arg : & mut T ) {
23
+ // TODO: Implement the function body.
23
24
???
24
25
}
25
26
Original file line number Diff line number Diff line change 6
6
// This function returns how much icecream there is left in the fridge.
7
7
// If it's before 10PM, there's 5 pieces left. At 10PM, someone eats them
8
8
// all, so there'll be no more left :(
9
- // TODO: Return an Option!
10
9
fn maybe_icecream ( time_of_day : u16 ) -> Option < u16 > {
11
10
// We use the 24-hour system here, so 10PM is a value of 22 and 12AM is a value of 0
12
11
// The Option output should gracefully handle cases where time_of_day > 23.
12
+ // TODO: Complete the function body - remember to return an Option!
13
13
???
14
14
}
15
15
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ trait AppendBar {
16
16
}
17
17
18
18
impl AppendBar for String {
19
- //Add your code here
19
+ // TODO: Implement `AppendBar` for type `String`.
20
20
}
21
21
22
22
fn main ( ) {
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ trait AppendBar {
17
17
fn append_bar ( self ) -> Self ;
18
18
}
19
19
20
- //TODO: Add your code here
20
+ // TODO: Implement trait `AppendBar` for a vector of strings.
21
21
22
22
#[ cfg( test) ]
23
23
mod tests {
You can’t perform that action at this time.
0 commit comments