From b77653ee8d0a43199b7303538fc0ba493f2c2217 Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Fri, 16 Feb 2024 14:30:01 +0800 Subject: [PATCH] fix typos (#390) --- src/idioms/deref.md | 2 +- src/idioms/ffi/errors.md | 2 +- src/patterns/behavioural/command.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/idioms/deref.md b/src/idioms/deref.md index e2f284e..c1f52bc 100644 --- a/src/idioms/deref.md +++ b/src/idioms/deref.md @@ -27,7 +27,7 @@ impl Deref for Vec { A `Vec` 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 -from `&Vec` to `&[T]` and includes the relationship in auto-derefencing +from `&Vec` to `&[T]` and includes the relationship in auto-dereferencing searches. Most methods you might expect to be implemented for `Vec`s are instead implemented for slices. diff --git a/src/idioms/ffi/errors.md b/src/idioms/ffi/errors.md index 5d5bed0..d364af1 100644 --- a/src/idioms/ffi/errors.md +++ b/src/idioms/ffi/errors.md @@ -4,7 +4,7 @@ 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 -propogated through a full type. +propagated through a full type. This best practice shows different kinds of error codes, and how to expose them in a usable way: diff --git a/src/patterns/behavioural/command.md b/src/patterns/behavioural/command.md index 969f584..58b62db 100644 --- a/src/patterns/behavioural/command.md +++ b/src/patterns/behavioural/command.md @@ -205,7 +205,7 @@ fn main() { 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 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/), 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