100 exercises to learn Rust

This commit is contained in:
LukeMathWalker
2024-05-12 22:21:03 +02:00
commit 5edebf6cf2
309 changed files with 13173 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
[package]
name = "as_cast"
version = "0.1.0"
edition = "2021"

View File

@@ -0,0 +1,22 @@
// TODO: based on what you learned in this section, replace `todo!()` with
// the correct value after the conversion.
#[cfg(test)]
mod tests {
#[test]
fn u16_to_u32() {
assert_eq!(47u16 as u32, todo!());
}
#[test]
#[allow(overflowing_literals)]
fn u8_to_i8() {
assert_eq!(255 as i8, todo!());
}
#[test]
fn bool_to_u8() {
assert_eq!(true as u8, todo!());
}
}