Compare commits
7 Commits
d698ccdc1e
...
45c5e390c0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
45c5e390c0 | ||
|
|
fe189a64e4 | ||
|
|
ee055245e5 | ||
|
|
a8ba7ddec6 | ||
|
|
d9b6b493e8 | ||
|
|
7d1d90fb37 | ||
|
|
69e7b28097 |
@@ -38,7 +38,7 @@ fn main() {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
There are other mechanism to work with recoverable errors in Rust, which [we'll cover later](../05_ticket_v2/06_fallibility).
|
There are other mechanisms to work with recoverable errors in Rust, which [we'll cover later](../05_ticket_v2/06_fallibility).
|
||||||
For the time being we'll stick with panics as a brutal but simple stopgap solution.
|
For the time being we'll stick with panics as a brutal but simple stopgap solution.
|
||||||
|
|
||||||
## References
|
## References
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ To understand what happens, let's start by looking at how `256u16` is
|
|||||||
represented in memory, as a sequence of bits:
|
represented in memory, as a sequence of bits:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0
|
0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0
|
||||||
| | |
|
| | |
|
||||||
+---------------+---------------+
|
+---------------+---------------+
|
||||||
First 8 bits Last 8 bits
|
First 8 bits Last 8 bits
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ For example: `MutexGuard` is not `Send`, but it is `Sync`.
|
|||||||
|
|
||||||
It isn't `Send` because the lock must be released on the same thread that acquired it, therefore we don't
|
It isn't `Send` because the lock must be released on the same thread that acquired it, therefore we don't
|
||||||
want `MutexGuard` to be dropped on a different thread.
|
want `MutexGuard` to be dropped on a different thread.
|
||||||
But it is `Sync`, because that has no impact on where the lock is released.
|
But it is `Sync`, because giving a `&MutexGuard` to another thread has no impact on where the lock is released.
|
||||||
|
|
||||||
## `Send` doesn't imply `Sync`
|
## `Send` doesn't imply `Sync`
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
// explanations.
|
// explanations.
|
||||||
// There are various ways to write comments in Rust, each with its own purpose.
|
// There are various ways to write comments in Rust, each with its own purpose.
|
||||||
// For now we'll stick to the most common one: the line comment.
|
// For now we'll stick to the most common one: the line comment.
|
||||||
// Everything from `//` to the end of the line is a considered comment.
|
// Everything from `//` to the end of the line is considered a comment.
|
||||||
|
|
||||||
// Exercises will include `TODO`, `todo!()` or `__` markers to draw your attention to the lines
|
// Exercises will include `TODO`, `todo!()` or `__` markers to draw your attention to the lines
|
||||||
// where you need to write code.
|
// where you need to write code.
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
#[should_panic(expected = "Title cannot be empty")]
|
#[should_panic(expected = "Title cannot be empty")]
|
||||||
fn title_cannot_be_empty() {
|
fn title_cannot_be_empty() {
|
||||||
Ticket::new("".into(), valid_title(), "To-Do".into());
|
Ticket::new("".into(), valid_description(), "To-Do".into());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
Reference in New Issue
Block a user