100 exercises to learn Rust

This commit is contained in:
LukeMathWalker committed 2024-05-12 22:47:45 +02:00
commit 5edebf6cf2
309 files changed
+13173

No files matched your search

@@ -0,0 +1,4 @@
[package]
name = "as_cast"
version = "0.1.0"
edition = "2021"
@@ -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!());
}
}