mirror of
https://github.com/rust-lang/rust
synced 2024-10-20 15:33:53 +00:00
Rollup merge of #87629 - steffahn:consistent_adapter_spelling, r=m-ou-se
Consistent spelling of "adapter" in the standard library Change all occurrences of "(A|a)daptor" to "(A|a)dapter". The spelling “adapter” seems to be significantly more common both in general in the English language and also in the `rust` repository and standard library. I don’t like the inconsistency that’s currently found on pages like https://doc.rust-lang.org/std/iter/trait.Iterator.html. Note however that the Rust book consistently uses the spelling “iterator adaptor”. Related discussion [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/adapter.20.2F.20adaptor) ([in the archive](https://zulip-archive.rust-lang.org/219381tlibs/60284adapteradaptor.html)). `@rustbot` label T-libs
This commit is contained in:
commit
87c143661c
|
@ -338,9 +338,9 @@ unsafe fn shrink(
|
|||
Ok(new_ptr)
|
||||
}
|
||||
|
||||
/// Creates a "by reference" adaptor for this instance of `Allocator`.
|
||||
/// Creates a "by reference" adapter for this instance of `Allocator`.
|
||||
///
|
||||
/// The returned adaptor also implements `Allocator` and will simply borrow this.
|
||||
/// The returned adapter also implements `Allocator` and will simply borrow this.
|
||||
#[inline(always)]
|
||||
fn by_ref(&self) -> &Self
|
||||
where
|
||||
|
|
|
@ -694,7 +694,7 @@ fn map<B, F>(self, f: F) -> Map<Self, F>
|
|||
/// more idiomatic to use a `for` loop, but `for_each` may be more legible
|
||||
/// when processing items at the end of longer iterator chains. In some
|
||||
/// cases `for_each` may also be faster than a loop, because it will use
|
||||
/// internal iteration on adaptors like `Chain`.
|
||||
/// internal iteration on adapters like `Chain`.
|
||||
///
|
||||
/// [`for`]: ../../book/ch03-05-control-flow.html#looping-through-a-collection-with-for
|
||||
///
|
||||
|
@ -1293,7 +1293,7 @@ fn take(self, n: usize) -> Take<Self>
|
|||
Take::new(self, n)
|
||||
}
|
||||
|
||||
/// An iterator adaptor similar to [`fold`] that holds internal state and
|
||||
/// An iterator adapter similar to [`fold`] that holds internal state and
|
||||
/// produces a new iterator.
|
||||
///
|
||||
/// [`fold`]: Iterator::fold
|
||||
|
@ -1604,7 +1604,7 @@ fn inspect<F>(self, f: F) -> Inspect<Self, F>
|
|||
|
||||
/// Borrows an iterator, rather than consuming it.
|
||||
///
|
||||
/// This is useful to allow applying iterator adaptors while still
|
||||
/// This is useful to allow applying iterator adapters while still
|
||||
/// retaining ownership of the original iterator.
|
||||
///
|
||||
/// # Examples
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
/// An iterator that panics whenever `next` or next_back` is called
|
||||
/// after `None` has already been returned. This does not violate
|
||||
/// `Iterator`'s contract. Used to test that iterator adaptors don't
|
||||
/// `Iterator`'s contract. Used to test that iterator adapters don't
|
||||
/// poll their inner iterators after exhausting them.
|
||||
pub struct NonFused<I> {
|
||||
iter: I,
|
||||
|
|
|
@ -810,9 +810,9 @@ fn read_exact(&mut self, buf: &mut [u8]) -> Result<()> {
|
|||
default_read_exact(self, buf)
|
||||
}
|
||||
|
||||
/// Creates a "by reference" adaptor for this instance of `Read`.
|
||||
/// Creates a "by reference" adapter for this instance of `Read`.
|
||||
///
|
||||
/// The returned adaptor also implements `Read` and will simply borrow this
|
||||
/// The returned adapter also implements `Read` and will simply borrow this
|
||||
/// current reader.
|
||||
///
|
||||
/// # Examples
|
||||
|
@ -889,7 +889,7 @@ fn bytes(self) -> Bytes<Self>
|
|||
Bytes { inner: self }
|
||||
}
|
||||
|
||||
/// Creates an adaptor which will chain this stream with another.
|
||||
/// Creates an adapter which will chain this stream with another.
|
||||
///
|
||||
/// The returned `Read` instance will first read all bytes from this object
|
||||
/// until EOF is encountered. Afterwards the output is equivalent to the
|
||||
|
@ -927,7 +927,7 @@ fn chain<R: Read>(self, next: R) -> Chain<Self, R>
|
|||
Chain { first: self, second: next, done_first: false }
|
||||
}
|
||||
|
||||
/// Creates an adaptor which will read at most `limit` bytes from it.
|
||||
/// Creates an adapter which will read at most `limit` bytes from it.
|
||||
///
|
||||
/// This function returns a new instance of `Read` which will read at most
|
||||
/// `limit` bytes, after which it will always return EOF ([`Ok(0)`]). Any
|
||||
|
@ -1326,7 +1326,7 @@ pub fn initialize(&self, buf: &mut [u8]) {
|
|||
/// * The [`write`] method will attempt to write some data into the object,
|
||||
/// returning how many bytes were successfully written.
|
||||
///
|
||||
/// * The [`flush`] method is useful for adaptors and explicit buffers
|
||||
/// * The [`flush`] method is useful for adapters and explicit buffers
|
||||
/// themselves for ensuring that all buffered data has been pushed out to the
|
||||
/// 'true sink'.
|
||||
///
|
||||
|
@ -1646,12 +1646,12 @@ fn write_all_vectored(&mut self, mut bufs: &mut [IoSlice<'_>]) -> Result<()> {
|
|||
fn write_fmt(&mut self, fmt: fmt::Arguments<'_>) -> Result<()> {
|
||||
// Create a shim which translates a Write to a fmt::Write and saves
|
||||
// off I/O errors. instead of discarding them
|
||||
struct Adaptor<'a, T: ?Sized + 'a> {
|
||||
struct Adapter<'a, T: ?Sized + 'a> {
|
||||
inner: &'a mut T,
|
||||
error: Result<()>,
|
||||
}
|
||||
|
||||
impl<T: Write + ?Sized> fmt::Write for Adaptor<'_, T> {
|
||||
impl<T: Write + ?Sized> fmt::Write for Adapter<'_, T> {
|
||||
fn write_str(&mut self, s: &str) -> fmt::Result {
|
||||
match self.inner.write_all(s.as_bytes()) {
|
||||
Ok(()) => Ok(()),
|
||||
|
@ -1663,7 +1663,7 @@ fn write_str(&mut self, s: &str) -> fmt::Result {
|
|||
}
|
||||
}
|
||||
|
||||
let mut output = Adaptor { inner: self, error: Ok(()) };
|
||||
let mut output = Adapter { inner: self, error: Ok(()) };
|
||||
match fmt::write(&mut output, fmt) {
|
||||
Ok(()) => Ok(()),
|
||||
Err(..) => {
|
||||
|
@ -1677,9 +1677,9 @@ fn write_str(&mut self, s: &str) -> fmt::Result {
|
|||
}
|
||||
}
|
||||
|
||||
/// Creates a "by reference" adaptor for this instance of `Write`.
|
||||
/// Creates a "by reference" adapter for this instance of `Write`.
|
||||
///
|
||||
/// The returned adaptor also implements `Write` and will simply borrow this
|
||||
/// The returned adapter also implements `Write` and will simply borrow this
|
||||
/// current writer.
|
||||
///
|
||||
/// # Examples
|
||||
|
@ -2263,7 +2263,7 @@ fn lines(self) -> Lines<Self>
|
|||
}
|
||||
}
|
||||
|
||||
/// Adaptor to chain together two readers.
|
||||
/// Adapter to chain together two readers.
|
||||
///
|
||||
/// This struct is generally created by calling [`chain`] on a reader.
|
||||
/// Please see the documentation of [`chain`] for more details.
|
||||
|
@ -2414,7 +2414,7 @@ fn upper_bound(&self) -> Option<usize> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Reader adaptor which limits the bytes read from an underlying reader.
|
||||
/// Reader adapter which limits the bytes read from an underlying reader.
|
||||
///
|
||||
/// This struct is generally created by calling [`take`] on a reader.
|
||||
/// Please see the documentation of [`take`] for more details.
|
||||
|
|
Loading…
Reference in a new issue