You've already forked comprehensive-rust
mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-11-28 00:39:01 +02:00
docs: improve language in generics section (#2884)
I asked Gemini to review the English for inconsistencies and grammar mistakes. This is the result and I hope it's useful! As a non-native speaker, it is hard for me to evaluate the finer details, so let me know if you would like to see changes (or even better: make them directly in the PR with the suggestion function).
This commit is contained in:
@@ -60,7 +60,7 @@ fn main() {
|
||||
instance of the function for each different type that the generic is
|
||||
instantiated with. This means that calling a trait method from within a
|
||||
generic function still uses static dispatch, as the compiler has full type
|
||||
information and can resolve which type's trait implementation to use.
|
||||
information and can resolve that type's trait implementation to use.
|
||||
|
||||
- When using `dyn Trait`, it instead uses dynamic dispatch through a
|
||||
[virtual method table][vtable] (vtable). This means that there's a single
|
||||
|
||||
@@ -44,7 +44,7 @@ fn main() {
|
||||
|
||||
<details>
|
||||
|
||||
- _Q:_ Why `L` is specified twice in `impl<L: Logger> .. VerbosityFilter<L>`?
|
||||
- _Q:_ Why is `L` specified twice in `impl<L: Logger> .. VerbosityFilter<L>`?
|
||||
Isn't that redundant?
|
||||
- This is because it is a generic implementation section for generic type.
|
||||
They are independently generic.
|
||||
|
||||
@@ -30,7 +30,7 @@ fn main() {
|
||||
|
||||
<details>
|
||||
|
||||
`impl Trait` allows you to work with types which you cannot name. The meaning of
|
||||
`impl Trait` allows you to work with types that you cannot name. The meaning of
|
||||
`impl Trait` is a bit different in the different positions.
|
||||
|
||||
- For a parameter, `impl Trait` is like an anonymous generic parameter with a
|
||||
|
||||
Reference in New Issue
Block a user