fix typos

pull/390/head
John Vandenberg 4 months ago
parent 345910d270
commit 5eb5b6a92b

@ -27,7 +27,7 @@ impl<T> Deref for Vec<T> {
A `Vec<T>` is an owning collection of `T`s, while a slice (`&[T]`) is a borrowed A `Vec<T>` is an owning collection of `T`s, while a slice (`&[T]`) is a borrowed
collection of `T`s. Implementing `Deref` for `Vec` allows implicit dereferencing collection of `T`s. Implementing `Deref` for `Vec` allows implicit dereferencing
from `&Vec<T>` to `&[T]` and includes the relationship in auto-derefencing from `&Vec<T>` to `&[T]` and includes the relationship in auto-dereferencing
searches. Most methods you might expect to be implemented for `Vec`s are instead searches. Most methods you might expect to be implemented for `Vec`s are instead
implemented for slices. implemented for slices.

@ -4,7 +4,7 @@
In foreign languages like C, errors are represented by return codes. However, In foreign languages like C, errors are represented by return codes. However,
Rust's type system allows much more rich error information to be captured and Rust's type system allows much more rich error information to be captured and
propogated through a full type. propagated through a full type.
This best practice shows different kinds of error codes, and how to expose them This best practice shows different kinds of error codes, and how to expose them
in a usable way: in a usable way:

@ -205,7 +205,7 @@ fn main() {
If our commands are small and may be defined as functions or passed as a closure If our commands are small and may be defined as functions or passed as a closure
then using function pointers might be preferable since it does not exploit then using function pointers might be preferable since it does not exploit
dynamic dispatch. But if our command is a whole struct with a bunch of functions dynamic dispatch. But if our command is a whole struct with a bunch of functions
and variables defined as seperated module then using trait objects would be more and variables defined as separated module then using trait objects would be more
suitable. A case of application can be found in [`actix`](https://actix.rs/), suitable. A case of application can be found in [`actix`](https://actix.rs/),
which uses trait objects when it registers a handler function for routes. In which uses trait objects when it registers a handler function for routes. In
case of using `Fn` trait objects we can create and use commands in the same way case of using `Fn` trait objects we can create and use commands in the same way

Loading…
Cancel
Save