Rollup merge of #82862 - athre0z:generalize-vec-write-impl, r=TimDiekmann
Generalize Write impl for Vec<u8> to Vec<u8, A> As discussed in the [issue tracker for the wg-allocators working group][1], updating this impl for allocator support was most likely just forgotten previously. This PR fixes this. r? `````@TimDiekmann````` [1]: https://github.com/rust-lang/wg-allocators/issues/86
This commit is contained in:
commit
3b0a02a26b
|
@ -1,6 +1,7 @@
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
|
||||||
|
use crate::alloc::Allocator;
|
||||||
use crate::cmp;
|
use crate::cmp;
|
||||||
use crate::fmt;
|
use crate::fmt;
|
||||||
use crate::io::{
|
use crate::io::{
|
||||||
|
@ -357,7 +358,7 @@ impl Write for &mut [u8] {
|
||||||
/// Write is implemented for `Vec<u8>` by appending to the vector.
|
/// Write is implemented for `Vec<u8>` by appending to the vector.
|
||||||
/// The vector will grow as needed.
|
/// The vector will grow as needed.
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
impl Write for Vec<u8> {
|
impl<A: Allocator> Write for Vec<u8, A> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||||
self.extend_from_slice(buf);
|
self.extend_from_slice(buf);
|
||||||
|
|
Loading…
Reference in New Issue