diff --git a/de-DE/faq.md b/de-DE/faq.md index b044b58d2..a2aeb4c41 100644 --- a/de-DE/faq.md +++ b/de-DE/faq.md @@ -367,7 +367,7 @@ Wie kann ich einen String oder Vec<T> in einen S Normalerweise kannst du eine Referenz zu einem `String` oder `Vec` immer dort übergeben, wo ein Slice passend wäre. Mithilfe von [Deref Coercions](https://doc.rust-lang.org/stable/book/deref-coercions.html) können [`String`s][String] und [`Vec`s][Vec] automatisch in ihren jeweiligen Slice-Typen „zerfallen“, wenn man eine Referenz darauf mit `&` oder `&mut` übergibt. -Methoden, die auf `&str` oder `&[T]` implementiert wurden, können auf `String` und `Vec` direkt aufgerufen werden. Der Aufruf `some_string.char_at(0)` zum Beispiel funktioniert, obwohl `char_at` eine Methode von `&str` und `some_string` ein `String` ist. +Methoden, die auf `&str` oder `&[T]` implementiert wurden, können auf `String` und `Vec` direkt aufgerufen werden. Der Aufruf `some_string.trim()` zum Beispiel funktioniert, obwohl `trim` eine Methode von `&str` und `some_string` ein `String` ist. Manchmal, zum Beispiel in generischem Code, wird manuelle Konversion notwendig. Diese kann man mit dem _Slicing-Operator_ `&my_vec[..]` erreicht werden. diff --git a/en-US/faq.md b/en-US/faq.md index fb4c5358e..b96048af0 100644 --- a/en-US/faq.md +++ b/en-US/faq.md @@ -373,7 +373,7 @@ How can I convert a String or Vec<T> to a slice Usually, you can pass a reference to a `String` or `Vec` wherever a slice is expected. Using [Deref coercions](https://doc.rust-lang.org/stable/book/second-edition/ch15-02-deref.html), [`String`s][String] and [`Vec`s][Vec] will automatically coerce to their respective slices when passed by reference with `&` or `& mut`. -Methods implemented on `&str` and `&[T]` can be accessed directly on `String` and `Vec`. For example, `some_string.char_at(0)` will work even though `char_at` is a method on `&str` and `some_string` is a `String`. +Methods implemented on `&str` and `&[T]` can be accessed directly on `String` and `Vec`. For example, `some_string.trim()` will work even though `trim` is a method on `&str` and `some_string` is a `String`. In some cases, such as generic code, it's necessary to convert manually. Manual conversions can be achieved using the slicing operator, like so: `&my_vec[..]`. diff --git a/es-ES/faq.md b/es-ES/faq.md index 700a6f9cc..95ffb47fb 100644 --- a/es-ES/faq.md +++ b/es-ES/faq.md @@ -373,7 +373,7 @@ How can I convert a String or Vec<T> to a slice Usually, you can pass a reference to a `String` or `Vec` wherever a slice is expected. Using [Deref coercions](https://doc.rust-lang.org/stable/book/deref-coercions.html), [`String`s][String] and [`Vec`s][Vec] will automatically coerce to their respective slices when passed by reference with `&` or `& mut`. -Methods implemented on `&str` and `&[T]` can be accessed directly on `String` and `Vec`. For example, `some_string.char_at(0)` will work even though `char_at` is a method on `&str` and `some_string` is a `String`. +Methods implemented on `&str` and `&[T]` can be accessed directly on `String` and `Vec`. For example, `some_string.trim()` will work even though `trim` is a method on `&str` and `some_string` is a `String`. In some cases, such as generic code, it's necessary to convert manually. Manual conversions can be achieved using the slicing operator, like so: `&my_vec[..]`. diff --git a/fr-FR/faq.md b/fr-FR/faq.md index acf138b33..8bfc95b93 100644 --- a/fr-FR/faq.md +++ b/fr-FR/faq.md @@ -373,7 +373,7 @@ How can I convert a String or Vec<T> to a slice Usually, you can pass a reference to a `String` or `Vec` wherever a slice is expected. Using [Deref coercions](https://doc.rust-lang.org/stable/book/deref-coercions.html), [`String`s][String] and [`Vec`s][Vec] will automatically coerce to their respective slices when passed by reference with `&` or `& mut`. -Methods implemented on `&str` and `&[T]` can be accessed directly on `String` and `Vec`. For example, `some_string.char_at(0)` will work even though `char_at` is a method on `&str` and `some_string` is a `String`. +Methods implemented on `&str` and `&[T]` can be accessed directly on `String` and `Vec`. For example, `some_string.trim()` will work even though `trim` is a method on `&str` and `some_string` is a `String`. In some cases, such as generic code, it's necessary to convert manually. Manual conversions can be achieved using the slicing operator, like so: `&my_vec[..]`. diff --git a/id-ID/faq.md b/id-ID/faq.md index 719556bcb..cf2b386d6 100644 --- a/id-ID/faq.md +++ b/id-ID/faq.md @@ -373,7 +373,7 @@ How can I convert a String or Vec<T> to a slice Usually, you can pass a reference to a `String` or `Vec` wherever a slice is expected. Using [Deref coercions](https://doc.rust-lang.org/stable/book/deref-coercions.html), [`String`s][String] and [`Vec`s][Vec] will automatically coerce to their respective slices when passed by reference with `&` or `& mut`. -Methods implemented on `&str` and `&[T]` can be accessed directly on `String` and `Vec`. For example, `some_string.char_at(0)` will work even though `char_at` is a method on `&str` and `some_string` is a `String`. +Methods implemented on `&str` and `&[T]` can be accessed directly on `String` and `Vec`. For example, `some_string.trim()` will work even though `trim` is a method on `&str` and `some_string` is a `String`. In some cases, such as generic code, it's necessary to convert manually. Manual conversions can be achieved using the slicing operator, like so: `&my_vec[..]`. diff --git a/it-IT/faq.md b/it-IT/faq.md index a05d81503..2f50cabb0 100644 --- a/it-IT/faq.md +++ b/it-IT/faq.md @@ -452,7 +452,7 @@ Solitamente, puoi passare un riferimento a una `String` o ad un `Vec` ovunque Utilizzando le [costrizione da de-riferimento](https://doc.rust-lang.org/stable/book/deref-coercions.html), [`String`][String] e [`Vec`][Vec] verrano automaticamente ridotti alle rispettive partizioni quando passate come riferimento tramite `&` o `& mut`. I metodi implementati su `&str` e `&[T]` possono essere utilizzati direttamente su `String` e `Vec`. -Ad esempio `una_stringa.char_at(0)` funzionerà anche se `char_at` è un metodo su `&str` e `una_stringa` è una `String`. +Ad esempio `una_stringa.trim()` funzionerà anche se `trim` è un metodo su `&str` e `una_stringa` è una `String`. In alcuni casi, come nella programmazione generica è necessario convertire manualmente, questa operazione è effettuabile utilizzando l'operatore di partizione, in questo modo: `&mio_vettore[..]`. diff --git a/ja-JP/faq.md b/ja-JP/faq.md index 245b61c5c..513d6c234 100644 --- a/ja-JP/faq.md +++ b/ja-JP/faq.md @@ -392,7 +392,7 @@ How can I convert a String or Vec<T> to a slice Usually, you can pass a reference to a `String` or `Vec` wherever a slice is expected. Using [Deref coercions](https://doc.rust-lang.org/stable/book/deref-coercions.html), [`String`s][String] and [`Vec`s][Vec] will automatically coerce to their respective slices when passed by reference with `&` or `& mut`. -Methods implemented on `&str` and `&[T]` can be accessed directly on `String` and `Vec`. For example, `some_string.char_at(0)` will work even though `char_at` is a method on `&str` and `some_string` is a `String`. +Methods implemented on `&str` and `&[T]` can be accessed directly on `String` and `Vec`. For example, `some_string.trim()` will work even though `trim` is a method on `&str` and `some_string` is a `String`. In some cases, such as generic code, it's necessary to convert manually. Manual conversions can be achieved using the slicing operator, like so: `&my_vec[..]`. diff --git a/ko-KR/faq.md b/ko-KR/faq.md index c891493ad..015c1b4ff 100644 --- a/ko-KR/faq.md +++ b/ko-KR/faq.md @@ -443,7 +443,7 @@ match val.do_something() { [`String`][String]과 [`Vec`][Vec]이 `&`나 `& mut` 참조로 넘겨질 때는 [deref 변환(coercion)](https://doc.rust-lang.org/stable/book/deref-coercions.html)을 통해 각자 대응되는 슬라이스로 자동으로 변환됩니다. `&str`과 `&[T]`에 구현된 메소드들은 `String`과 `Vec`에서 바로 접근할 수 있습니다. -예를 들어 `char_at`은 `&str`의 메소드이고 `some_string`이 `String`이라 하더라도 `some_string.char_at(0)`은 동작할 것입니다. +예를 들어 `trim`은 `&str`의 메소드이고 `some_string`이 `String`이라 하더라도 `some_string.trim()`은 동작할 것입니다. 일반화된 코드 같이 몇몇 상황에서는 수동으로 변환해야 할 필요가 있습니다. 수동 변환은 슬라이스 연산자를 써서 `&my_vec[..]`과 같이 할 수 있습니다. diff --git a/pt-BR/faq.md b/pt-BR/faq.md index acf138b33..8bfc95b93 100644 --- a/pt-BR/faq.md +++ b/pt-BR/faq.md @@ -373,7 +373,7 @@ How can I convert a String or Vec<T> to a slice Usually, you can pass a reference to a `String` or `Vec` wherever a slice is expected. Using [Deref coercions](https://doc.rust-lang.org/stable/book/deref-coercions.html), [`String`s][String] and [`Vec`s][Vec] will automatically coerce to their respective slices when passed by reference with `&` or `& mut`. -Methods implemented on `&str` and `&[T]` can be accessed directly on `String` and `Vec`. For example, `some_string.char_at(0)` will work even though `char_at` is a method on `&str` and `some_string` is a `String`. +Methods implemented on `&str` and `&[T]` can be accessed directly on `String` and `Vec`. For example, `some_string.trim()` will work even though `trim` is a method on `&str` and `some_string` is a `String`. In some cases, such as generic code, it's necessary to convert manually. Manual conversions can be achieved using the slicing operator, like so: `&my_vec[..]`. diff --git a/sv-SE/faq.md b/sv-SE/faq.md index c81c560c3..474b41b4e 100644 --- a/sv-SE/faq.md +++ b/sv-SE/faq.md @@ -373,7 +373,7 @@ How can I convert a String or Vec<T> to a slice Usually, you can pass a reference to a `String` or `Vec` wherever a slice is expected. Using [Deref coercions](https://doc.rust-lang.org/stable/book/second-edition/ch15-02-deref.html), [`String`s][String] and [`Vec`s][Vec] will automatically coerce to their respective slices when passed by reference with `&` or `& mut`. -Methods implemented on `&str` and `&[T]` can be accessed directly on `String` and `Vec`. For example, `some_string.char_at(0)` will work even though `char_at` is a method on `&str` and `some_string` is a `String`. +Methods implemented on `&str` and `&[T]` can be accessed directly on `String` and `Vec`. For example, `some_string.trim()` will work even though `trim` is a method on `&str` and `some_string` is a `String`. In some cases, such as generic code, it's necessary to convert manually. Manual conversions can be achieved using the slicing operator, like so: `&my_vec[..]`. diff --git a/vi-VN/faq.md b/vi-VN/faq.md index 93a58f639..35f8931c9 100644 --- a/vi-VN/faq.md +++ b/vi-VN/faq.md @@ -373,7 +373,7 @@ How can I convert a String or Vec<T> to a slice Usually, you can pass a reference to a `String` or `Vec` wherever a slice is expected. Using [Deref coercions](https://doc.rust-lang.org/stable/book/deref-coercions.html), [`String`s][String] and [`Vec`s][Vec] will automatically coerce to their respective slices when passed by reference with `&` or `& mut`. -Methods implemented on `&str` and `&[T]` can be accessed directly on `String` and `Vec`. For example, `some_string.char_at(0)` will work even though `char_at` is a method on `&str` and `some_string` is a `String`. +Methods implemented on `&str` and `&[T]` can be accessed directly on `String` and `Vec`. For example, `some_string.trim()` will work even though `trim` is a method on `&str` and `some_string` is a `String`. In some cases, such as generic code, it's necessary to convert manually. Manual conversions can be achieved using the slicing operator, like so: `&my_vec[..]`. diff --git a/zh-CN/faq.md b/zh-CN/faq.md index f85461dd8..f7a1d6365 100644 --- a/zh-CN/faq.md +++ b/zh-CN/faq.md @@ -369,7 +369,7 @@ match val.do_something() { 通常,你可以在需要切片的地方传入 `String` 或 `Vec`。使用[强制解引(Deref)](https://doc.rust-lang.org/stable/book/deref-coercions.html),在用 `&` 或 `&mut` 传递引用时,[`String`][String] 和 [`Vec`][Vec] 会自动强制转换为对应的切片。 -在 `&str` 和 `&[T]` 上实现的方法可以直接在 `String` 和 `Vec` 上访问。例如,即使 `char_at` 是 `&str` 上的方法,而 `some_string` 是一个 `String`,`some_string.char_at(0)` 也可以运行。 +在 `&str` 和 `&[T]` 上实现的方法可以直接在 `String` 和 `Vec` 上访问。例如,即使 `trim` 是 `&str` 上的方法,而 `some_string` 是一个 `String`,`some_string.trim()` 也可以运行。 在某些情况下,例如泛型代码,需要手动转换。可以用切片操作符实现手动转换,如:`&my_vec[..]`。