Skip to content
This repository was archived by the owner on Sep 30, 2020. It is now read-only.

Replace usages of char_at with trim. #993

Merged
merged 1 commit into from
Jan 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion de-DE/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ Wie kann ich einen <code>String</code> oder <code>Vec&lt;T&gt;</code> in einen S
Normalerweise kannst du eine Referenz zu einem `String` oder `Vec<T>` 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<T>` 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<T>` 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.

Expand Down
2 changes: 1 addition & 1 deletion en-US/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ How can I convert a <code>String</code> or <code>Vec&lt;T&gt;</code> to a slice
Usually, you can pass a reference to a `String` or `Vec<T>` 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<T>`. 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<T>`. 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[..]`.

Expand Down
2 changes: 1 addition & 1 deletion es-ES/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ How can I convert a <code>String</code> or <code>Vec&lt;T&gt;</code> to a slice
Usually, you can pass a reference to a `String` or `Vec<T>` 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<T>`. 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<T>`. 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[..]`.

Expand Down
2 changes: 1 addition & 1 deletion fr-FR/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ How can I convert a <code>String</code> or <code>Vec&lt;T&gt;</code> to a slice
Usually, you can pass a reference to a `String` or `Vec<T>` 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<T>`. 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<T>`. 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[..]`.

Expand Down
2 changes: 1 addition & 1 deletion id-ID/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ How can I convert a <code>String</code> or <code>Vec&lt;T&gt;</code> to a slice
Usually, you can pass a reference to a `String` or `Vec<T>` 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<T>`. 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<T>`. 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[..]`.

Expand Down
2 changes: 1 addition & 1 deletion it-IT/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ Solitamente, puoi passare un riferimento a una `String` o ad un `Vec<T>` 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<T>`.
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[..]`.

Expand Down
2 changes: 1 addition & 1 deletion ja-JP/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ How can I convert a <code>String</code> or <code>Vec&lt;T&gt;</code> to a slice
Usually, you can pass a reference to a `String` or `Vec<T>` 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<T>`. 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<T>`. 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[..]`.

Expand Down
2 changes: 1 addition & 1 deletion ko-KR/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>`에서 바로 접근할 수 있습니다.
예를 들어 `char_at`은 `&str`의 메소드이고 `some_string`이 `String`이라 하더라도 `some_string.char_at(0)`은 동작할 것입니다.
예를 들어 `trim`은 `&str`의 메소드이고 `some_string`이 `String`이라 하더라도 `some_string.trim()`은 동작할 것입니다.

일반화된 코드 같이 몇몇 상황에서는 수동으로 변환해야 할 필요가 있습니다.
수동 변환은 슬라이스 연산자를 써서 `&my_vec[..]`과 같이 할 수 있습니다.
Expand Down
2 changes: 1 addition & 1 deletion pt-BR/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ How can I convert a <code>String</code> or <code>Vec&lt;T&gt;</code> to a slice
Usually, you can pass a reference to a `String` or `Vec<T>` 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<T>`. 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<T>`. 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[..]`.

Expand Down
2 changes: 1 addition & 1 deletion sv-SE/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ How can I convert a <code>String</code> or <code>Vec&lt;T&gt;</code> to a slice
Usually, you can pass a reference to a `String` or `Vec<T>` 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<T>`. 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<T>`. 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[..]`.

Expand Down
2 changes: 1 addition & 1 deletion vi-VN/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ How can I convert a <code>String</code> or <code>Vec&lt;T&gt;</code> to a slice
Usually, you can pass a reference to a `String` or `Vec<T>` 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<T>`. 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<T>`. 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[..]`.

Expand Down
2 changes: 1 addition & 1 deletion zh-CN/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ match val.do_something() {

通常,你可以在需要切片的地方传入 `String` 或 `Vec<T>`。使用[强制解引(Deref)](https://doc.rust-lang.org/stable/book/deref-coercions.html),在用 `&` 或 `&mut` 传递引用时,[`String`][String] 和 [`Vec`][Vec] 会自动强制转换为对应的切片。

在 `&str` 和 `&[T]` 上实现的方法可以直接在 `String` 和 `Vec<T>` 上访问。例如,即使 `char_at` 是 `&str` 上的方法,而 `some_string` 是一个 `String`,`some_string.char_at(0)` 也可以运行。
在 `&str` 和 `&[T]` 上实现的方法可以直接在 `String` 和 `Vec<T>` 上访问。例如,即使 `trim` 是 `&str` 上的方法,而 `some_string` 是一个 `String`,`some_string.trim()` 也可以运行。

在某些情况下,例如泛型代码,需要手动转换。可以用切片操作符实现手动转换,如:`&my_vec[..]`。

Expand Down