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

Commit a47c176

Browse files
committed
Replace usages of char_at with trim.
rust-lang/rust#46942
1 parent 2a7ef22 commit a47c176

File tree

12 files changed

+12
-12
lines changed

12 files changed

+12
-12
lines changed

de-DE/faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ Wie kann ich einen <code>String</code> oder <code>Vec&lt;T&gt;</code> in einen S
367367
Normalerweise kannst du eine Referenz zu einem `String` oder `Vec<T>` immer dort übergeben, wo ein Slice passend wäre.
368368
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.
369369

370-
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.
370+
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.
371371

372372
Manchmal, zum Beispiel in generischem Code, wird manuelle Konversion notwendig. Diese kann man mit dem _Slicing-Operator_ `&my_vec[..]` erreicht werden.
373373

en-US/faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ How can I convert a <code>String</code> or <code>Vec&lt;T&gt;</code> to a slice
373373
Usually, you can pass a reference to a `String` or `Vec<T>` wherever a slice is expected.
374374
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`.
375375

376-
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`.
376+
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`.
377377

378378
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[..]`.
379379

es-ES/faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ How can I convert a <code>String</code> or <code>Vec&lt;T&gt;</code> to a slice
373373
Usually, you can pass a reference to a `String` or `Vec<T>` wherever a slice is expected.
374374
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`.
375375

376-
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`.
376+
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`.
377377

378378
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[..]`.
379379

fr-FR/faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ How can I convert a <code>String</code> or <code>Vec&lt;T&gt;</code> to a slice
373373
Usually, you can pass a reference to a `String` or `Vec<T>` wherever a slice is expected.
374374
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`.
375375

376-
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`.
376+
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`.
377377

378378
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[..]`.
379379

id-ID/faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ How can I convert a <code>String</code> or <code>Vec&lt;T&gt;</code> to a slice
373373
Usually, you can pass a reference to a `String` or `Vec<T>` wherever a slice is expected.
374374
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`.
375375

376-
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`.
376+
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`.
377377

378378
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[..]`.
379379

it-IT/faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ Solitamente, puoi passare un riferimento a una `String` o ad un `Vec<T>` ovunque
452452
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`.
453453

454454
I metodi implementati su `&str` e `&[T]` possono essere utilizzati direttamente su `String` e `Vec<T>`.
455-
Ad esempio `una_stringa.char_at(0)` funzionerà anche se `char_at` è un metodo su `&str` e `una_stringa` è una `String`.
455+
Ad esempio `una_stringa.trim()` funzionerà anche se `trim` è un metodo su `&str` e `una_stringa` è una `String`.
456456

457457
In alcuni casi, come nella programmazione generica è necessario convertire manualmente, questa operazione è effettuabile utilizzando l'operatore di partizione, in questo modo: `&mio_vettore[..]`.
458458

ja-JP/faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ How can I convert a <code>String</code> or <code>Vec&lt;T&gt;</code> to a slice
392392
Usually, you can pass a reference to a `String` or `Vec<T>` wherever a slice is expected.
393393
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`.
394394

395-
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`.
395+
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`.
396396

397397
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[..]`.
398398

ko-KR/faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ match val.do_something() {
443443
[`String`][String][`Vec`][Vec]`&``& mut` 참조로 넘겨질 때는 [deref 변환(coercion)](https://doc.rust-lang.org/stable/book/deref-coercions.html)을 통해 각자 대응되는 슬라이스로 자동으로 변환됩니다.
444444

445445
`&str``&[T]`에 구현된 메소드들은 `String``Vec<T>`에서 바로 접근할 수 있습니다.
446-
예를 들어 `char_at``&str`의 메소드이고 `some_string``String`이라 하더라도 `some_string.char_at(0)`은 동작할 것입니다.
446+
예를 들어 `trim``&str`의 메소드이고 `some_string``String`이라 하더라도 `some_string.trim()`은 동작할 것입니다.
447447

448448
일반화된 코드 같이 몇몇 상황에서는 수동으로 변환해야 할 필요가 있습니다.
449449
수동 변환은 슬라이스 연산자를 써서 `&my_vec[..]`과 같이 할 수 있습니다.

pt-BR/faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ How can I convert a <code>String</code> or <code>Vec&lt;T&gt;</code> to a slice
373373
Usually, you can pass a reference to a `String` or `Vec<T>` wherever a slice is expected.
374374
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`.
375375

376-
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`.
376+
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`.
377377

378378
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[..]`.
379379

sv-SE/faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ How can I convert a <code>String</code> or <code>Vec&lt;T&gt;</code> to a slice
373373
Usually, you can pass a reference to a `String` or `Vec<T>` wherever a slice is expected.
374374
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`.
375375

376-
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`.
376+
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`.
377377

378378
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[..]`.
379379

vi-VN/faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ How can I convert a <code>String</code> or <code>Vec&lt;T&gt;</code> to a slice
373373
Usually, you can pass a reference to a `String` or `Vec<T>` wherever a slice is expected.
374374
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`.
375375

376-
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`.
376+
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`.
377377

378378
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[..]`.
379379

zh-CN/faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ match val.do_something() {
369369

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

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

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

0 commit comments

Comments
 (0)