chore: added more descriptive TODOs
This commit is contained in:
parent
be0b7e084e
commit
a315f2fefb
|
@ -5,21 +5,22 @@
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
// Obtain the number of bytes (not characters) in the given argument
|
// Obtain the number of bytes (not characters) in the given argument.
|
||||||
// Add the AsRef trait appropriately as a trait bound
|
// TODO: Add the AsRef trait appropriately as a trait bound.
|
||||||
fn byte_counter<T>(arg: T) -> usize {
|
fn byte_counter<T>(arg: T) -> usize {
|
||||||
arg.as_ref().as_bytes().len()
|
arg.as_ref().as_bytes().len()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Obtain the number of characters (not bytes) in the given argument
|
// Obtain the number of characters (not bytes) in the given argument.
|
||||||
// Add the AsRef trait appropriately as a trait bound
|
// TODO: Add the AsRef trait appropriately as a trait bound.
|
||||||
fn char_counter<T>(arg: T) -> usize {
|
fn char_counter<T>(arg: T) -> usize {
|
||||||
arg.as_ref().chars().count()
|
arg.as_ref().chars().count()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Squares a number using as_mut(). Add the trait bound as is appropriate and
|
// Squares a number using as_mut().
|
||||||
// implement the function body.
|
// TODO: Add the appropriate trait bound.
|
||||||
fn num_sq<T>(arg: &mut T) {
|
fn num_sq<T>(arg: &mut T) {
|
||||||
|
// TODO: Implement the function body.
|
||||||
???
|
???
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
// This function returns how much icecream there is left in the fridge.
|
// This function returns how much icecream there is left in the fridge.
|
||||||
// If it's before 10PM, there's 5 pieces left. At 10PM, someone eats them
|
// If it's before 10PM, there's 5 pieces left. At 10PM, someone eats them
|
||||||
// all, so there'll be no more left :(
|
// all, so there'll be no more left :(
|
||||||
// TODO: Return an Option!
|
|
||||||
fn maybe_icecream(time_of_day: u16) -> Option<u16> {
|
fn maybe_icecream(time_of_day: u16) -> Option<u16> {
|
||||||
// We use the 24-hour system here, so 10PM is a value of 22 and 12AM is a value of 0
|
// We use the 24-hour system here, so 10PM is a value of 22 and 12AM is a value of 0
|
||||||
// The Option output should gracefully handle cases where time_of_day > 23.
|
// The Option output should gracefully handle cases where time_of_day > 23.
|
||||||
|
// TODO: Complete the function body - remember to return an Option!
|
||||||
???
|
???
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ trait AppendBar {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AppendBar for String {
|
impl AppendBar for String {
|
||||||
//Add your code here
|
// TODO: Implement `AppendBar` for type `String`.
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -17,7 +17,7 @@ trait AppendBar {
|
||||||
fn append_bar(self) -> Self;
|
fn append_bar(self) -> Self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: Add your code here
|
// TODO: Implement trait `AppendBar` for a vector of strings.
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
|
Loading…
Reference in New Issue