mirror of
https://github.com/notohh/rustlings.git
synced 2024-11-26 07:14:17 -05:00
fix(structs1): rename to unit-like struct
This commit is contained in:
parent
19bec50399
commit
4dffa0d10d
2 changed files with 6 additions and 6 deletions
|
@ -11,7 +11,7 @@ struct ColorClassicStruct {
|
||||||
struct ColorTupleStruct(/* TODO: Something goes here */);
|
struct ColorTupleStruct(/* TODO: Something goes here */);
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct UnitStruct;
|
struct UnitLikeStruct;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
@ -39,10 +39,10 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn unit_structs() {
|
fn unit_structs() {
|
||||||
// TODO: Instantiate a unit struct!
|
// TODO: Instantiate a unit-like struct!
|
||||||
// let unit_struct =
|
// let unit_like_struct =
|
||||||
let message = format!("{:?}s are fun!", unit_struct);
|
let message = format!("{:?}s are fun!", unit_like_struct);
|
||||||
|
|
||||||
assert_eq!(message, "UnitStructs are fun!");
|
assert_eq!(message, "UnitLikeStructs are fun!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -367,7 +367,7 @@ hint = """
|
||||||
Rust has more than one type of struct. Three actually, all variants are used to package related data together.
|
Rust has more than one type of struct. Three actually, all variants are used to package related data together.
|
||||||
There are normal (or classic) structs. These are named collections of related data stored in fields.
|
There are normal (or classic) structs. These are named collections of related data stored in fields.
|
||||||
Tuple structs are basically just named tuples.
|
Tuple structs are basically just named tuples.
|
||||||
Finally, Unit structs. These don't have any fields and are useful for generics.
|
Finally, Unit-like structs. These don't have any fields and are useful for generics.
|
||||||
|
|
||||||
In this exercise you need to complete and implement one of each kind.
|
In this exercise you need to complete and implement one of each kind.
|
||||||
Read more about structs in The Book: https://doc.rust-lang.org/book/ch05-01-defining-structs.html"""
|
Read more about structs in The Book: https://doc.rust-lang.org/book/ch05-01-defining-structs.html"""
|
||||||
|
|
Loading…
Reference in a new issue