File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -15,8 +15,6 @@ standard library includes an assortment of useful macros.
1515- ` dbg!(expression) ` logs the value of the expression and returns it.
1616- ` todo!() ` marks a bit of code as not-yet-implemented. If executed, it will
1717 panic.
18- - ` unreachable!() ` marks a bit of code as unreachable. If executed, it will
19- panic.
2018
2119``` rust,editable
2220fn factorial(n: u32) -> u32 {
@@ -46,4 +44,19 @@ especially critical.
4644The course does not cover defining macros, but a later section will describe use
4745of derive macros.
4846
47+ ## More To Explore
48+
49+ There are a number of other useful macros provided by the standard library. Some
50+ other examples you can share with students if they want to know more:
51+
52+ - [ ` assert! ` ] and related macros can be used to add assertions to your code.
53+ These are used heavily in writing tests.
54+ - [ ` unreachable! ` ] is used to mark a branch of control flow that should never be
55+ hit.
56+ - [ ` eprintln! ` ] allows you to print to stderr.
57+
4958</details >
59+
60+ [ `assert!` ] : https://doc.rust-lang.org/stable/std/macro.assert.html
61+ [ `unreachable!` ] : https://doc.rust-lang.org/stable/std/macro.unreachable.html
62+ [ `eprintln!` ] : https://doc.rust-lang.org/stable/std/macro.eprintln.html
You can’t perform that action at this time.
0 commit comments