mirror of
https://github.com/rust-lang/book.git
synced 2026-09-14 14:30:38 -04:00
spellingz
This commit is contained in:
@@ -44,6 +44,7 @@ ChangeColor
|
||||
ChangeColorMessage
|
||||
chXX
|
||||
chYY
|
||||
ConcreteType
|
||||
config
|
||||
Config
|
||||
const
|
||||
@@ -193,6 +194,7 @@ namespacing
|
||||
newfound
|
||||
NewsArticle
|
||||
newtype
|
||||
newtypes
|
||||
nitty
|
||||
nocapture
|
||||
nomicon
|
||||
@@ -208,6 +210,7 @@ OptionalNumber
|
||||
OsStr
|
||||
OsString
|
||||
other's
|
||||
OutlinePrint
|
||||
overread
|
||||
parameterize
|
||||
ParseIntError
|
||||
@@ -215,6 +218,7 @@ PartialEq
|
||||
PartialOrd
|
||||
PendingReview
|
||||
PendingReviewPost
|
||||
PlaceholderType
|
||||
portia
|
||||
powi
|
||||
preprocessing
|
||||
@@ -295,6 +299,7 @@ Supertraits
|
||||
test's
|
||||
TextField
|
||||
That'd
|
||||
there'd
|
||||
threadsafe
|
||||
timestamp
|
||||
Tiếng
|
||||
|
||||
@@ -354,7 +354,7 @@ fn main() {
|
||||
<span class="caption">Listing 19-27: Implementing two traits that both have a
|
||||
method with the same name as a method defined on the struct directly</span>
|
||||
|
||||
For the implemetation of the `f` method for the `Foo` trait on `Baz`, we're
|
||||
For the implementation of the `f` method for the `Foo` trait on `Baz`, we're
|
||||
printing out `Baz's impl of Foo`. For the implementation of the `f` method for
|
||||
the `Bar` trait on `Baz`, we're printing out `Baz's impl of Bar`. The
|
||||
implementation of `f` directly on `Baz` prints out `Baz's impl`. What should
|
||||
|
||||
@@ -282,9 +282,9 @@ said this about `&str`:
|
||||
> ... it’s a reference to an internal position in the String and the number of
|
||||
> elements that it refers to.
|
||||
|
||||
So while a `&T` is a single value that stors the memory address of where the `T`
|
||||
is located, a `&str` is *two* values: the address of the `str` and how long it
|
||||
is. As such, a `&str` has a size we can know at compile time: it's two times
|
||||
So while a `&T` is a single value that stores the memory address of where the
|
||||
`T` is located, a `&str` is *two* values: the address of the `str` and how long
|
||||
it is. As such, a `&str` has a size we can know at compile time: it's two times
|
||||
the size of a `usize` in length. That is, we always know the size of a `&str`,
|
||||
no matter how long the string it refers to is. This is the general way in which
|
||||
dynamically sized types are used in Rust; they have an extra bit of metadata
|
||||
@@ -309,7 +309,7 @@ To work with DSTs, Rust has a trait that determines if a type's size is known
|
||||
at compile time or not, which is `Sized`. This trait is automatically
|
||||
implemented for everything the compiler knows the size of at compile time. In
|
||||
addition, Rust implicitly adds a bound on `Sized` to every generic function.
|
||||
That is, a generic function definitition like this:
|
||||
That is, a generic function definition like this:
|
||||
|
||||
```rust,ignore
|
||||
fn generic<T>(t: T) {
|
||||
|
||||
Reference in New Issue
Block a user