ArcSliceMut

Struct ArcSliceMut 

Source
pub struct ArcSliceMut<S: Slice + ?Sized, L: LayoutMut = DefaultLayoutMut, const UNIQUE: bool = true> { /* private fields */ }
Expand description

A thread-safe, mutable and growable container.

ArcSliceMut has a smaller choice of layout than ArcSlice, but can also wrap arbitrary buffers such asVec, memory-mapped files, etc. Arbitrary metadata can also be attached to the buffer for contextual or domain-specific needs.

With UNIQUE=true, ArcSliceMut is roughly equivalent to a Vec. Additional capacity can be reserved and the slice can be extended. With UNIQUE=false, the slice may be shared, meaning that multiple ArcSliceMut may reference non-intersecting portions of the underlying buffer. In that case, capacity reservation might fail, but the slice will never be implicitly reallocated and copied. In any case, ArcSliceMut is cheaply convertible to ArcSlice.

It is mainly intended to manipulate [u8]/str byte slices, to facilitate zero-copy operations in network programming, hence the aliases ArcBytesMut/ArcStrMut. But it can actually handle any type of slices, from strings with specific invariants to primitive slices with droppable items.

§Examples

use arc_slice::{ArcSlice, ArcSliceMut};

let mut s = ArcSliceMut::<[u8]>::with_capacity(64);
s.push(b'h');
s.extend_from_slice(b"ello");
assert_eq!(s, b"hello");

let mut s = s.into_shared();
let mut s2 = s.split_off(3);
s.copy_from_slice(b"bye");
s2.copy_from_slice(b"!!");
s.try_unsplit(s2).unwrap();
assert_eq!(s, b"bye!!");

let frozen: ArcSlice<[u8]> = s.freeze();
assert_eq!(frozen, b"bye!!");

With shared memory:

use std::{
    fs::File,
    path::{Path, PathBuf},
};

use arc_slice::{buffer::AsMutBuffer, error::TryReserveError, layout::ArcLayout, ArcSliceMut};
use memmap2::MmapMut;

let path = Path::new("README.md").to_owned();
let file = File::options().read(true).write(true).open(&path)?;
let mmap = unsafe { MmapMut::map_mut(&file)? };

let buffer = unsafe { AsMutBuffer::new(mmap) };
let mut bytes: ArcSliceMut<[u8], ArcLayout<true>> =
    ArcSliceMut::from_buffer_with_metadata(buffer, path);
bytes[..11].copy_from_slice(b"# arc-slice");
assert!(bytes.starts_with(b"# arc-slice"));
assert_eq!(bytes.metadata::<PathBuf>().unwrap(), Path::new("README.md"));

Implementations§

Source§

impl<S: Slice + ?Sized, L: LayoutMut, const UNIQUE: bool> ArcSliceMut<S, L, UNIQUE>

Source

pub const fn len(&self) -> usize

Returns the number of items in the slice.

§Examples
use arc_slice::ArcSliceMut;

let s = ArcSliceMut::<[u8]>::from(&[0, 1, 2]);
assert_eq!(s.len(), 3);
Source

pub const fn is_empty(&self) -> bool

Returns true if the slice contains no items.

§Examples
use arc_slice::ArcSliceMut;

let s = ArcSliceMut::<[u8]>::from(&[0, 1, 2]);
assert!(!s.is_empty());

let s = ArcSliceMut::<[u8]>::from(&[]);
assert!(s.is_empty());
Source

pub const fn as_ptr(&self) -> *const S::Item

Returns a raw pointer to the slice’s first item.

See slice::as_ptr.

Source

pub fn as_mut_ptr(&mut self) -> *mut S::Item

Returns a mutable raw pointer to the slice’s first item.

See slice::as_mut_ptr.

Source

pub fn as_slice(&self) -> &S

Returns a reference to the underlying slice.

Equivalent to &self[..].

§Examples
use arc_slice::ArcSliceMut;

let s = ArcSliceMut::<[u8]>::from(b"hello world");
assert_eq!(s.as_slice(), b"hello world");
Source

pub fn as_mut_slice(&mut self) -> &mut S

Returns a mutable reference to the underlying slice.

Equivalent to &mut self[..].

§Examples
use arc_slice::ArcSliceMut;

let mut s = ArcSliceMut::<[u8]>::from(b"hello world");
assert_eq!(s.as_mut_slice(), b"hello world");
Source

pub const fn capacity(&self) -> usize

Returns the total number of items the slice can hold without reallocating.

use arc_slice::ArcSliceMut;

let mut s = ArcSliceMut::<[u8]>::with_capacity(64);
s.push(0);
assert_eq!(s.capacity(), 64);
Source

pub unsafe fn spare_capacity_mut(&mut self) -> &mut [MaybeUninit<S::Item>]
where S: Extendable,

Returns the remaining spare capacity of the slice.

The returned slice can be used to fill the slice with items before marking the data as initialized using the set_len method.

§Safety

Writing uninitialized memory may be unsound if the underlying buffer doesn’t support it.

§Examples
use arc_slice::ArcSliceMut;
let mut s = ArcSliceMut::<[u8]>::with_capacity(10);

// SAFETY: no uninit bytes are written
let uninit = unsafe { s.spare_capacity_mut() };
uninit[0].write(0);
uninit[1].write(1);
uninit[2].write(2);
// SAFETY: the first 3 bytes are initialized
unsafe { s.set_len(3) }

assert_eq!(s, [0, 1, 2]);
Source

pub unsafe fn set_len(&mut self, new_len: usize)
where S: Extendable,

Forces the length of the slice to new_len.

§Safety

First len items of the slice must be initialized.

§Examples
use arc_slice::ArcSliceMut;
let mut s = ArcSliceMut::<[u8]>::with_capacity(10);

// SAFETY: `s.capacity()` >= 3
unsafe { std::ptr::copy_nonoverlapping([0, 1, 2].as_ptr(), s.as_mut_ptr(), 3) };

// SAFETY: the first 3 bytes are initialized
unsafe { s.set_len(3) }

assert_eq!(s, [0, 1, 2]);
Source

pub fn try_push(&mut self, item: S::Item) -> Result<(), TryReserveError>
where S: Extendable,

Tries appending an element to the end of the slice, returning an error if the capacity reservation fails.

The buffer might have to reserve additional capacity to do the appending.

The default arc-slice buffer supports amortized reservation, doubling the capacity each time.

§Examples
use arc_slice::ArcSliceMut;

let mut s = ArcSliceMut::<[u8]>::new();
s.try_push(42)?;
assert_eq!(s, [42]);
Source

pub fn try_reclaim(&mut self, additional: usize) -> bool

Tries reclaiming additional capacity for at least additional more items without reallocating the buffer, returning true if it succeeds.

Does nothing if the spare capacity is greater than the requested one.

Reclaiming means shifting the current slice to the front of the buffer. It is only possible when the ArcSliceMut is unique, and when the slice doesn’t overlap with the spare capacity at the buffer front.

The reclaimed capacity might be greater than the requested one.

§Examples
use arc_slice::ArcSliceMut;

let mut s = ArcSliceMut::<[u8]>::from_iter(0..64);
let ptr = s.as_ptr();
s.advance(60);
assert_eq!(s.capacity(), 4);
assert_eq!(s, [60, 61, 62, 63]);

// Reclamation of less than 60 bytes succeeds, bringing back the full capacity.
assert!(s.try_reclaim(16));
assert_eq!(s.capacity(), 64);
assert_eq!(s, [60, 61, 62, 63]);
assert_eq!(s.as_ptr(), ptr);
// Trying reclaiming more capacity fails.
assert!(!s.try_reclaim(100));
Source

pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError>

Tries reserving capacity for at least additional more items, returning an error if the operation fails.

Does nothing if the spare capacity is greater than the requested one.

Reserving is only possible when the ArcSliceMut is unique, and when it is supported by the underlying buffer. It always attempts to reclaim first, and reallocates the buffer if that fails.

The default arc-slice buffer supports amortized reservation, doubling the capacity each time. The reserved capacity might be greater than the requested one.

§Examples
use arc_slice::ArcSliceMut;

let mut s = ArcSliceMut::<[u8]>::new();
s.try_reserve(3)?;
assert!(s.capacity() >= 3);
s.extend_from_slice(&[0, 1, 2]);
assert_eq!(s, [0, 1, 2]);
Source

pub fn try_extend_from_slice( &mut self, slice: &S, ) -> Result<(), TryReserveError>
where S: Concatenable, S::Item: Copy,

Tries appending a slice to the end of slice, returning an error if the capacity reservation fails.

The buffer might have to reserve additional capacity to do the appending.

The default arc-slice buffer supports amortized reservation, doubling the capacity each time.

use arc_slice::ArcSliceMut;

let mut s = ArcSliceMut::<[u8]>::new();
s.try_extend_from_slice(b"hello world")?;
assert_eq!(s, b"hello world");
Source

pub fn advance(&mut self, offset: usize)

Advances the start of the slice by offset items.

This operation does not touch the underlying buffer.

§Panics

Panics if offset > self.len().

§Examples
use arc_slice::ArcSliceMut;

let mut s = ArcSliceMut::<[u8]>::from(b"hello world");
s.advance(6);
assert_eq!(s, b"world");
Source

pub fn truncate(&mut self, len: usize)

Truncate the slice to the first len items.

If len is greater than the slice length, this has no effect.

use arc_slice::ArcSliceMut;

let mut s = ArcSliceMut::<[u8]>::from(b"hello world");
s.truncate(5);
assert_eq!(s, b"hello");
Source

pub fn metadata<M: Any>(&self) -> Option<&M>

Accesses the metadata of the underlying buffer if it can be successfully downcast.

§Examples
use arc_slice::{layout::ArcLayout, ArcSliceMut};

let metadata = "metadata".to_string();
let s =
    ArcSliceMut::<[u8], ArcLayout<true>>::from_buffer_with_metadata(vec![0, 1, 2], metadata);
assert_eq!(s.metadata::<String>().unwrap(), "metadata");
Source

pub fn try_into_buffer<B: BufferMut<S>>(self) -> Result<B, Self>

Tries downcasting the ArcSliceMut to its underlying buffer.

§Examples
use arc_slice::{layout::ArcLayout, ArcSliceMut};

let s = ArcSliceMut::<[u8], ArcLayout<true>>::from(vec![0, 1, 2]);
assert_eq!(s.try_into_buffer::<Vec<u8>>().unwrap(), [0, 1, 2]);
Source

pub fn try_into_unique(self) -> Result<ArcSliceMut<S, L, true>, Self>

Tries turning the shared ArcSliceMut into a unique one.

§Examples
use arc_slice::ArcSliceMut;

let mut a = ArcSliceMut::<[u8]>::from(b"hello world").into_shared();
let b = a.split_to(5);
assert!(a.try_into_unique().is_err());
// a has been dropped
assert!(b.try_into_unique().is_ok());
Source

pub fn into_shared(self) -> ArcSliceMut<S, L, false>

Turns the unique ArcSliceMut into a shared one.

Shared ArcSliceMut can be split.

§Examples
use arc_slice::ArcSliceMut;

let mut a = ArcSliceMut::<[u8]>::from(b"hello world").into_shared();
let b = a.split_to(5);
Source

pub fn try_freeze<L2: Layout>(self) -> Result<ArcSlice<S, L2>, Self>

Tries freezing the slice, returning an immutable ArcSlice.

If the mutable slice was split into several parts, only the current one is frozen.

The conversion may allocate depending on the given layouts, but allocation errors are caught and the original slice is returned in this case.

§Examples
use arc_slice::{layout::DefaultLayoutMut, ArcSlice, ArcSliceMut};

let mut s = ArcSliceMut::<[u8]>::with_capacity(16);
s.extend_from_slice(b"hello world");

let frozen: ArcSlice<[u8]> = s.try_freeze().unwrap();
Source

pub fn try_with_layout<L2: LayoutMut>( self, ) -> Result<ArcSliceMut<S, L2, UNIQUE>, Self>

Tries to replace the layout of the ArcSliceMut, returning the original slice if it fails.

The layouts must be compatible for the conversion to succeed, see FromLayout.

The conversion may allocate depending on the given layouts, but allocation errors are caught and the original slice is also returned in this case.

§Examples
use arc_slice::{
    layout::{ArcLayout, BoxedSliceLayout, VecLayout},
    ArcSliceMut,
};

let a = ArcSliceMut::<[u8], VecLayout>::from(vec![0, 1, 2]);

let b = a.try_with_layout::<ArcLayout<true>>().unwrap();
assert!(b.try_with_layout::<ArcLayout<false>>().is_err());
Source

pub fn into_arc_slice_mut(self) -> ArcSliceMut<[S::Item], L, UNIQUE>

Converts an ArcSliceMut into a primitive ArcSliceMut.

§Examples
use arc_slice::ArcSliceMut;

let s = ArcSliceMut::<str>::from("hello world");
let bytes: ArcSliceMut<[u8]> = s.into_arc_slice_mut();
assert_eq!(bytes, b"hello world");
Source

pub fn try_from_arc_slice_mut( slice: ArcSliceMut<[S::Item], L, UNIQUE>, ) -> Result<Self, (S::TryFromSliceError, ArcSliceMut<[S::Item], L, UNIQUE>)>

Tries converting an item slice into the given ArcSliceMut.

The conversion uses Slice::try_from_slice_mut.

§Examples
use arc_slice::ArcSliceMut;

let utf8 = ArcSliceMut::<[u8]>::from(b"hello world");
let not_utf8 = ArcSliceMut::<[u8]>::from(b"\x80\x81");

assert!(ArcSliceMut::<str>::try_from_arc_slice_mut(utf8).is_ok());
assert!(ArcSliceMut::<str>::try_from_arc_slice_mut(not_utf8).is_err());
Source

pub unsafe fn from_arc_slice_mut_unchecked( slice: ArcSliceMut<[S::Item], L, UNIQUE>, ) -> Self

Converts an item slice into the given ArcSliceMut, without checking the slice validity.

§Safety

The operation has the same contract as Slice::from_slice_mut_unchecked.

§Examples
use arc_slice::ArcSliceMut;

let utf8 = ArcSliceMut::<[u8]>::from(b"hello world");

// SAFETY: `utf8` is a valid utf8 string
let s = unsafe { ArcSliceMut::<str>::from_arc_slice_mut_unchecked(utf8) };
assert_eq!(s, "hello world");
Source§

impl<S: Slice + ?Sized, L: LayoutMut, const UNIQUE: bool> ArcSliceMut<S, L, UNIQUE>

Source

pub fn freeze<L2: FromLayout<L>>(self) -> ArcSlice<S, L2>

Available on crate feature oom-handling only.

Freeze the slice, returning an immutable ArcSlice.

If the mutable slice was split into several parts, only the current one is frozen.

§Examples
use arc_slice::{layout::DefaultLayoutMut, ArcSlice, ArcSliceMut};

let mut s = ArcSliceMut::<[u8]>::with_capacity(16);
s.extend_from_slice(b"hello world");

let frozen: ArcSlice<[u8]> = s.freeze();
Source

pub fn with_layout<L2: LayoutMut + FromLayout<L>>( self, ) -> ArcSliceMut<S, L2, UNIQUE>

Available on crate feature oom-handling only.

Replace the layout of the ArcSliceMut.

The layouts must be compatible, see FromLayout.

§Examples
use arc_slice::{
    layout::{ArcLayout, BoxedSliceLayout, VecLayout},
    ArcSliceMut,
};

let a = ArcSliceMut::<[u8]>::from(b"hello world");

let b = a.with_layout::<VecLayout>();
Source§

impl<S: Slice + ?Sized, L: LayoutMut> ArcSliceMut<S, L>

Source

pub const fn new() -> Self
where S: Emptyable,

Creates a new empty ArcSliceMut.

This operation doesn’t allocate.

§Examples
use arc_slice::{layout::ArcLayout, ArcSliceMut};

let s = ArcSliceMut::<[u8]>::new();
assert_eq!(s, []);
Source

pub fn from_slice(slice: &S) -> Self
where S::Item: Copy,

Available on crate feature oom-handling only.

Creates a new ArcSliceMut by copying the given slice.

§Panics

Panics if the new capacity exceeds isize::MAX - size_of::<usize>() bytes.

§Examples
use arc_slice::ArcSliceMut;

let s = ArcSliceMut::<[u8]>::from_slice(b"hello world");
assert_eq!(s, b"hello world");
Source

pub fn try_from_slice(slice: &S) -> Result<Self, AllocError>
where S::Item: Copy,

Tries creating a new ArcSliceMut by copying the given slice, returning an error if the allocation fails.

§Examples
use arc_slice::ArcSliceMut;

let s = ArcSliceMut::<[u8]>::try_from_slice(b"hello world")?;
assert_eq!(s, b"hello world");
Source

pub fn with_capacity(capacity: usize) -> Self
where S: Emptyable,

Available on crate feature oom-handling only.

Creates a new ArcSliceMut with the given capacity.

This operation allocates if capacity > 0.

§Panics

Panics if the new capacity exceeds isize::MAX - size_of::<usize>() bytes.

§Examples
use arc_slice::ArcSliceMut;

let s = ArcSliceMut::<[u8]>::with_capacity(64);
assert_eq!(s, []);
assert_eq!(s.capacity(), 64);
Source

pub fn try_with_capacity(capacity: usize) -> Result<Self, AllocError>
where S: Emptyable,

Available on crate feature oom-handling only.

Tries creating a new ArcSliceMut with the given capacity, returning an error if an allocation fails.

This operation allocates if capacity > 0.

§Panics

Panics if the new capacity exceeds isize::MAX - size_of::<usize>() bytes.

§Examples
use arc_slice::ArcSliceMut;

let s = ArcSliceMut::<[u8]>::try_with_capacity(64)?;
assert_eq!(s, []);
assert_eq!(s.capacity(), 64);
Source

pub fn zeroed(length: usize) -> Self
where S: Zeroable,

Available on crate feature oom-handling only.

Creates a new zeroed ArcSliceMut with the given capacity.

This operation allocates if capacity > 0. All the items are initialized to 0.

§Panics

Panics if the new capacity exceeds isize::MAX - size_of::<usize>() bytes.

§Examples
use arc_slice::ArcSliceMut;

let s = ArcSliceMut::<[u8]>::zeroed(4);
assert_eq!(s, [0, 0, 0, 0]);
assert_eq!(s.capacity(), 4);
Source

pub fn try_zeroed(length: usize) -> Result<Self, AllocError>
where S: Zeroable,

Tries creating a new zeroed ArcSliceMut with the given capacity.

This operation allocates if capacity > 0. All the items are initialized to 0.

§Panics

Panics if the new capacity exceeds isize::MAX - size_of::<usize>() bytes.

§Examples
use arc_slice::ArcSliceMut;

let s = ArcSliceMut::<[u8]>::zeroed(4);
assert_eq!(s, [0, 0, 0, 0]);
assert_eq!(s.capacity(), 4);
Source

pub fn reserve(&mut self, additional: usize)

Available on crate feature oom-handling only.

Reserve capacity for at least additional more items.

Does nothing if the spare capacity is greater than the requested one.

Reserving always attempts to reclaim first, and reallocates the buffer if that fails.

The default arc-slice buffer supports amortized reservation, doubling the capacity each time. The reserved capacity might be greater than the requested one.

§Panics

Panics if the new capacity exceeds isize::MAX bytes, or if the underlying buffer doesn’t support additional capacity reservation.

§Examples
use arc_slice::ArcSliceMut;

let mut s = ArcSliceMut::<[u8]>::new();
s.reserve(3);
assert!(s.capacity() >= 3);
s.extend_from_slice(&[0, 1, 2]);
assert_eq!(s, [0, 1, 2]);
Source

pub fn push(&mut self, item: S::Item)
where S: Extendable,

Available on crate feature oom-handling only.

Appends an element to the end of the slice.

The buffer might have to reserve additional capacity to do the appending.

The default arc-slice buffer supports amortized reservation, doubling the capacity each time.

§Panics

See reserve.

§Examples
use arc_slice::ArcSliceMut;

let mut s = ArcSliceMut::<[u8]>::new();
s.push(42);
assert_eq!(s, [42]);
Source

pub fn extend_from_slice(&mut self, slice: &S)
where S: Concatenable, S::Item: Copy,

Available on crate feature oom-handling only.

Appends a slice to the end of slice.

The buffer might have to reserve additional capacity to do the appending.

The default arc-slice buffer supports amortized reservation, doubling the capacity each time.

§Panics

See reserve.

use arc_slice::ArcSliceMut;

let mut s = ArcSliceMut::<[u8]>::new();
s.extend_from_slice(b"hello world");
assert_eq!(s, b"hello world");
Source§

impl<T: Send + Sync + 'static, L: LayoutMut> ArcSliceMut<[T], L>

Source

pub fn from_array<const N: usize>(array: [T; N]) -> Self

Available on crate feature oom-handling only.

Creates a new ArcSliceMut by moving the given array.

§Panics

Panics if the new capacity exceeds isize::MAX - size_of::<usize>() bytes.

§Examples
use arc_slice::ArcSliceMut;

let s = ArcSliceMut::<[u8]>::from_array([0, 1, 2]);
assert_eq!(s, [0, 1, 2]);
Source

pub fn try_from_array<const N: usize>(array: [T; N]) -> Result<Self, [T; N]>

Tries creating a new ArcSliceMut by moving the given array, returning it if an allocation fails.

§Examples
use arc_slice::ArcSliceMut;

let s = ArcSliceMut::<[u8]>::try_from_array([0, 1, 2]).unwrap();
assert_eq!(s, [0, 1, 2]);
Source§

impl<S: Slice + ?Sized, L: LayoutMut> ArcSliceMut<S, L, false>

Source

pub fn try_split_off(&mut self, at: usize) -> Result<Self, AllocError>

Tries splitting the slice into two at the given index, returning an error if an allocation fails.

Afterwards self contains elements [0, at), and the returned ArcSliceMut contains elements [at, len). This operation does not touch the underlying buffer.

The operation may allocate. See CloneNoAllocLayout documentation for cases where it does not.

§Panics

Panics if at > self.len().

§Examples
use arc_slice::ArcSliceMut;

let mut a = ArcSliceMut::<[u8]>::from(b"hello world").into_shared();
let b = a.try_split_off(5)?;

assert_eq!(a, b"hello");
assert_eq!(b, b" world");
Source

pub fn try_split_to(&mut self, at: usize) -> Result<Self, AllocError>

Tries splitting the slice into two at the given index, returning an error if an allocation fails.

Afterwards self contains elements [at, len), and the returned ArcSliceMut contains elements [0, at). This operation does not touch the underlying buffer.

The operation may allocate. See CloneNoAllocLayout documentation for cases where it does not.

§Panics

Panics if at > self.len().

§Examples
use arc_slice::ArcSliceMut;

let mut a = ArcSliceMut::<[u8]>::from(b"hello world").into_shared();
let b = a.try_split_to(5)?;

assert_eq!(a, b" world");
assert_eq!(b, b"hello");
Source

pub fn try_unsplit( &mut self, other: ArcSliceMut<S, L, false>, ) -> Result<(), ArcSliceMut<S, L, false>>

Tries unsplitting two parts of a previously split slice.

§Examples
use arc_slice::ArcSliceMut;

let mut a = ArcSliceMut::<[u8]>::from(b"hello world").into_shared();

let b = a.split_off(5);
assert_eq!(a, b"hello");
assert_eq!(b, b" world");
a.try_unsplit(b).unwrap();
assert_eq!(a, b"hello world");

assert!(a
    .try_unsplit(ArcSliceMut::from(b"other").into_shared())
    .is_err());
Source§

impl<S: Slice + ?Sized, L: LayoutMut> ArcSliceMut<S, L, false>

Source

pub fn split_off(&mut self, at: usize) -> Self

Splits the slice into two at the given index.

Afterwards self contains elements [0, at), and the returned ArcSliceMut contains elements [at, len). This operation does not touch the underlying buffer.

§Panics

Panics if at > self.capacity().

§Examples
use arc_slice::ArcSliceMut;

let mut a = ArcSliceMut::<[u8]>::from(b"hello world").into_shared();
let b = a.split_off(5);

assert_eq!(a, b"hello");
assert_eq!(b, b" world");
Source

pub fn split_to(&mut self, at: usize) -> Self

Splits the slice into two at the given index.

Afterwards self contains elements [at, len), and the returned ArcSliceMut contains elements [0, at). This operation does not touch the underlying buffer.

§Panics

Panics if at > self.len().

§Examples
use arc_slice::ArcSliceMut;

let mut a = ArcSliceMut::<[u8]>::from(b"hello world").into_shared();
let b = a.split_to(5);

assert_eq!(a, b" world");
assert_eq!(b, b"hello");
Source§

impl<S: Slice + ?Sized, L: AnyBufferLayout + LayoutMut> ArcSliceMut<S, L>

Source

pub fn from_buffer<B: BufferMut<S>>(buffer: B) -> Self

Available on crate feature oom-handling only.

Creates a new ArcSliceMut with the given underlying buffer.

The buffer can be extracted back using try_into_buffer.

§Examples
use arc_slice::{layout::ArcLayout, ArcSliceMut};

let s = ArcSliceMut::<[u8], ArcLayout<true>>::from_buffer(vec![0, 1, 2]);
assert_eq!(s, [0, 1, 2]);
assert_eq!(s.try_into_buffer::<Vec<u8>>().unwrap(), vec![0, 1, 2]);
Source

pub fn try_from_buffer<B: BufferMut<S>>(buffer: B) -> Result<Self, B>

Tries creating a new ArcSliceMut with the given underlying buffer, returning it if an allocation fails.

The buffer can be extracted back using try_into_buffer.

Having an Arc allocation depends on the layout and the buffer type, e.g. there will be no allocation for a Vec with VecLayout.

§Examples
use arc_slice::{layout::ArcLayout, ArcSliceMut};

let s = ArcSliceMut::<[u8], ArcLayout<true>>::try_from_buffer(vec![0, 1, 2]).unwrap();
assert_eq!(s, [0, 1, 2]);
assert_eq!(s.try_into_buffer::<Vec<u8>>().unwrap(), vec![0, 1, 2]);
Source

pub fn from_buffer_with_metadata<B: BufferMut<S>, M: Send + Sync + 'static>( buffer: B, metadata: M, ) -> Self

Available on crate feature oom-handling only.

Creates a new ArcSliceMut with the given underlying buffer and its associated metadata.

The buffer can be extracted back using try_into_buffer; metadata can be retrieved with metadata.

§Examples
use arc_slice::{layout::ArcLayout, ArcSliceMut};

let metadata = "metadata".to_string();
let s =
    ArcSliceMut::<[u8], ArcLayout<true>>::from_buffer_with_metadata(vec![0, 1, 2], metadata);
assert_eq!(s, [0, 1, 2]);
assert_eq!(s.metadata::<String>().unwrap(), "metadata");
assert_eq!(s.try_into_buffer::<Vec<u8>>().unwrap(), vec![0, 1, 2]);
Source

pub fn try_from_buffer_with_metadata<B: BufferMut<S>, M: Send + Sync + 'static>( buffer: B, metadata: M, ) -> Result<Self, (B, M)>

Tries creates a new ArcSliceMut with the given underlying buffer and its associated metadata, returning them if an allocation fails.

The buffer can be extracted back using try_into_buffer; metadata can be retrieved with metadata.

Having an Arc allocation depends on the layout and the buffer type, e.g. there will be no allocation for a Vec with VecLayout.

§Examples
use arc_slice::{layout::ArcLayout, ArcSliceMut};

let metadata = "metadata".to_string();
let s = ArcSliceMut::<[u8], ArcLayout<true>>::try_from_buffer_with_metadata(
    vec![0, 1, 2],
    metadata,
)
.unwrap();
assert_eq!(s, [0, 1, 2]);
assert_eq!(s.metadata::<String>().unwrap(), "metadata");
assert_eq!(s.try_into_buffer::<Vec<u8>>().unwrap(), vec![0, 1, 2]);
Source

pub fn from_buffer_with_borrowed_metadata<B: BufferMut<S> + BorrowMetadata>( buffer: B, ) -> Self

Available on crate feature oom-handling only.

Creates a new ArcSliceMut with the given underlying buffer with borrowed metadata.

The buffer can be extracted back using try_into_buffer; metadata can be retrieved with metadata.

§Examples
use arc_slice::{
    buffer::{BorrowMetadata, Buffer, BufferMut},
    error::TryReserveError,
    layout::ArcLayout,
    ArcSliceMut,
};

#[derive(Debug, PartialEq, Eq)]
struct MyBuffer(Vec<u8>);
impl Buffer<[u8]> for MyBuffer {
    fn as_slice(&self) -> &[u8] {
        &self.0
    }
}
#[derive(Debug, PartialEq, Eq)]
struct MyMetadata;
impl BorrowMetadata for MyBuffer {
    type Metadata = MyMetadata;
    fn borrow_metadata(&self) -> &Self::Metadata {
        &MyMetadata
    }
}
// SAFETY: `MyBuffer` delegates to `Vec<u8>`, which upholds the invariant
unsafe impl BufferMut<[u8]> for MyBuffer {
    fn as_mut_slice(&mut self) -> &mut [u8] {
        &mut self.0
    }
    fn capacity(&self) -> usize {
        self.0.capacity()
    }
    unsafe fn set_len(&mut self, len: usize) -> bool {
        // SAFETY: same function contract
        unsafe { self.0.set_len(len) };
        true
    }
    fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> {
        BufferMut::try_reserve(&mut self.0, additional)
    }
}
let buffer = MyBuffer(vec![0, 1, 2]);
let s = ArcSliceMut::<[u8], ArcLayout<true>>::from_buffer_with_borrowed_metadata(buffer);
assert_eq!(s, [0, 1, 2]);
assert_eq!(s.metadata::<MyMetadata>().unwrap(), &MyMetadata);
assert_eq!(
    s.try_into_buffer::<MyBuffer>().unwrap(),
    MyBuffer(vec![0, 1, 2])
);
Source

pub fn try_from_buffer_with_borrowed_metadata<B: BufferMut<S> + BorrowMetadata>( buffer: B, ) -> Result<Self, B>

Tries creating a new ArcSliceMut with the given underlying buffer with borrowed metadata, returning it if an allocation fails.

The buffer can be extracted back using try_into_buffer; metadata can be retrieved with metadata.

Having an Arc allocation depends on the layout and the buffer type, e.g. there will be no allocation for a Vec with VecLayout.

§Examples
use arc_slice::{
    buffer::{BorrowMetadata, Buffer, BufferMut},
    error::TryReserveError,
    layout::ArcLayout,
    ArcSliceMut,
};

#[derive(Debug, PartialEq, Eq)]
struct MyBuffer(Vec<u8>);
impl Buffer<[u8]> for MyBuffer {
    fn as_slice(&self) -> &[u8] {
        &self.0
    }
}
// SAFETY: `MyBuffer` delegates to `Vec<u8>`, which upholds the invariant
unsafe impl BufferMut<[u8]> for MyBuffer {
    fn as_mut_slice(&mut self) -> &mut [u8] {
        &mut self.0
    }
    fn capacity(&self) -> usize {
        self.0.capacity()
    }
    unsafe fn set_len(&mut self, len: usize) -> bool {
        // SAFETY: same function contract
        unsafe { self.0.set_len(len) };
        true
    }
    fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> {
        BufferMut::try_reserve(&mut self.0, additional)
    }
}
#[derive(Debug, PartialEq, Eq)]
struct MyMetadata;
impl BorrowMetadata for MyBuffer {
    type Metadata = MyMetadata;
    fn borrow_metadata(&self) -> &Self::Metadata {
        &MyMetadata
    }
}
let buffer = MyBuffer(vec![0, 1, 2]);
let s = ArcSliceMut::<[u8], ArcLayout<true>>::try_from_buffer_with_borrowed_metadata(buffer)
    .unwrap();
assert_eq!(s, [0, 1, 2]);
assert_eq!(s.metadata::<MyMetadata>().unwrap(), &MyMetadata);
assert_eq!(
    s.try_into_buffer::<MyBuffer>().unwrap(),
    MyBuffer(vec![0, 1, 2])
);

Trait Implementations§

Source§

impl<S: Slice + ?Sized, L: LayoutMut, const UNIQUE: bool> AsMut<S> for ArcSliceMut<S, L, UNIQUE>

Source§

fn as_mut(&mut self) -> &mut S

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<S: Slice + ?Sized, L: LayoutMut, const UNIQUE: bool> AsRef<S> for ArcSliceMut<S, L, UNIQUE>

Source§

fn as_ref(&self) -> &S

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<S: Slice + ?Sized, L: LayoutMut, const UNIQUE: bool> Borrow<S> for ArcSliceMut<S, L, UNIQUE>

Source§

fn borrow(&self) -> &S

Immutably borrows from an owned value. Read more
Source§

impl<S: Slice + ?Sized, L: LayoutMut, const UNIQUE: bool> BorrowMut<S> for ArcSliceMut<S, L, UNIQUE>

Source§

fn borrow_mut(&mut self) -> &mut S

Mutably borrows from an owned value. Read more
Source§

impl<S: Slice<Item = u8> + Subsliceable + ?Sized, L: LayoutMut, const UNIQUE: bool> Buf for ArcSliceMut<S, L, UNIQUE>

Available on crate feature bytes only.
Source§

fn remaining(&self) -> usize

Returns the number of bytes between the current position and the end of the buffer. Read more
Source§

fn chunk(&self) -> &[u8]

Returns a slice starting at the current position and of length between 0 and Buf::remaining(). Note that this can return a shorter slice (this allows non-continuous internal representation). Read more
Source§

fn advance(&mut self, cnt: usize)

Advance the internal cursor of the Buf Read more
Source§

fn has_remaining(&self) -> bool

Returns true if there are any more bytes to consume Read more
Source§

fn copy_to_slice(&mut self, dst: &mut [u8])

Copies bytes from self into dst. Read more
Source§

fn get_u8(&mut self) -> u8

Gets an unsigned 8 bit integer from self. Read more
Source§

fn get_i8(&mut self) -> i8

Gets a signed 8 bit integer from self. Read more
Source§

fn get_u16(&mut self) -> u16

Gets an unsigned 16 bit integer from self in big-endian byte order. Read more
Source§

fn get_u16_le(&mut self) -> u16

Gets an unsigned 16 bit integer from self in little-endian byte order. Read more
Source§

fn get_u16_ne(&mut self) -> u16

Gets an unsigned 16 bit integer from self in native-endian byte order. Read more
Source§

fn get_i16(&mut self) -> i16

Gets a signed 16 bit integer from self in big-endian byte order. Read more
Source§

fn get_i16_le(&mut self) -> i16

Gets a signed 16 bit integer from self in little-endian byte order. Read more
Source§

fn get_i16_ne(&mut self) -> i16

Gets a signed 16 bit integer from self in native-endian byte order. Read more
Source§

fn get_u32(&mut self) -> u32

Gets an unsigned 32 bit integer from self in the big-endian byte order. Read more
Source§

fn get_u32_le(&mut self) -> u32

Gets an unsigned 32 bit integer from self in the little-endian byte order. Read more
Source§

fn get_u32_ne(&mut self) -> u32

Gets an unsigned 32 bit integer from self in native-endian byte order. Read more
Source§

fn get_i32(&mut self) -> i32

Gets a signed 32 bit integer from self in big-endian byte order. Read more
Source§

fn get_i32_le(&mut self) -> i32

Gets a signed 32 bit integer from self in little-endian byte order. Read more
Source§

fn get_i32_ne(&mut self) -> i32

Gets a signed 32 bit integer from self in native-endian byte order. Read more
Source§

fn get_u64(&mut self) -> u64

Gets an unsigned 64 bit integer from self in big-endian byte order. Read more
Source§

fn get_u64_le(&mut self) -> u64

Gets an unsigned 64 bit integer from self in little-endian byte order. Read more
Source§

fn get_u64_ne(&mut self) -> u64

Gets an unsigned 64 bit integer from self in native-endian byte order. Read more
Source§

fn get_i64(&mut self) -> i64

Gets a signed 64 bit integer from self in big-endian byte order. Read more
Source§

fn get_i64_le(&mut self) -> i64

Gets a signed 64 bit integer from self in little-endian byte order. Read more
Source§

fn get_i64_ne(&mut self) -> i64

Gets a signed 64 bit integer from self in native-endian byte order. Read more
Source§

fn get_u128(&mut self) -> u128

Gets an unsigned 128 bit integer from self in big-endian byte order. Read more
Source§

fn get_u128_le(&mut self) -> u128

Gets an unsigned 128 bit integer from self in little-endian byte order. Read more
Source§

fn get_u128_ne(&mut self) -> u128

Gets an unsigned 128 bit integer from self in native-endian byte order. Read more
Source§

fn get_i128(&mut self) -> i128

Gets a signed 128 bit integer from self in big-endian byte order. Read more
Source§

fn get_i128_le(&mut self) -> i128

Gets a signed 128 bit integer from self in little-endian byte order. Read more
Source§

fn get_i128_ne(&mut self) -> i128

Gets a signed 128 bit integer from self in native-endian byte order. Read more
Source§

fn get_uint(&mut self, nbytes: usize) -> u64

Gets an unsigned n-byte integer from self in big-endian byte order. Read more
Source§

fn get_uint_le(&mut self, nbytes: usize) -> u64

Gets an unsigned n-byte integer from self in little-endian byte order. Read more
Source§

fn get_uint_ne(&mut self, nbytes: usize) -> u64

Gets an unsigned n-byte integer from self in native-endian byte order. Read more
Source§

fn get_int(&mut self, nbytes: usize) -> i64

Gets a signed n-byte integer from self in big-endian byte order. Read more
Source§

fn get_int_le(&mut self, nbytes: usize) -> i64

Gets a signed n-byte integer from self in little-endian byte order. Read more
Source§

fn get_int_ne(&mut self, nbytes: usize) -> i64

Gets a signed n-byte integer from self in native-endian byte order. Read more
Source§

fn get_f32(&mut self) -> f32

Gets an IEEE754 single-precision (4 bytes) floating point number from self in big-endian byte order. Read more
Source§

fn get_f32_le(&mut self) -> f32

Gets an IEEE754 single-precision (4 bytes) floating point number from self in little-endian byte order. Read more
Source§

fn get_f32_ne(&mut self) -> f32

Gets an IEEE754 single-precision (4 bytes) floating point number from self in native-endian byte order. Read more
Source§

fn get_f64(&mut self) -> f64

Gets an IEEE754 double-precision (8 bytes) floating point number from self in big-endian byte order. Read more
Source§

fn get_f64_le(&mut self) -> f64

Gets an IEEE754 double-precision (8 bytes) floating point number from self in little-endian byte order. Read more
Source§

fn get_f64_ne(&mut self) -> f64

Gets an IEEE754 double-precision (8 bytes) floating point number from self in native-endian byte order. Read more
Source§

fn try_copy_to_slice(&mut self, dst: &mut [u8]) -> Result<(), TryGetError>

Copies bytes from self into dst. Read more
Source§

fn try_get_u8(&mut self) -> Result<u8, TryGetError>

Gets an unsigned 8 bit integer from self. Read more
Source§

fn try_get_i8(&mut self) -> Result<i8, TryGetError>

Gets a signed 8 bit integer from self. Read more
Source§

fn try_get_u16(&mut self) -> Result<u16, TryGetError>

Gets an unsigned 16 bit integer from self in big-endian byte order. Read more
Source§

fn try_get_u16_le(&mut self) -> Result<u16, TryGetError>

Gets an unsigned 16 bit integer from self in little-endian byte order. Read more
Source§

fn try_get_u16_ne(&mut self) -> Result<u16, TryGetError>

Gets an unsigned 16 bit integer from self in native-endian byte order. Read more
Source§

fn try_get_i16(&mut self) -> Result<i16, TryGetError>

Gets a signed 16 bit integer from self in big-endian byte order. Read more
Source§

fn try_get_i16_le(&mut self) -> Result<i16, TryGetError>

Gets an signed 16 bit integer from self in little-endian byte order. Read more
Source§

fn try_get_i16_ne(&mut self) -> Result<i16, TryGetError>

Gets a signed 16 bit integer from self in native-endian byte order. Read more
Source§

fn try_get_u32(&mut self) -> Result<u32, TryGetError>

Gets an unsigned 32 bit integer from self in big-endian byte order. Read more
Source§

fn try_get_u32_le(&mut self) -> Result<u32, TryGetError>

Gets an unsigned 32 bit integer from self in little-endian byte order. Read more
Source§

fn try_get_u32_ne(&mut self) -> Result<u32, TryGetError>

Gets an unsigned 32 bit integer from self in native-endian byte order. Read more
Source§

fn try_get_i32(&mut self) -> Result<i32, TryGetError>

Gets a signed 32 bit integer from self in big-endian byte order. Read more
Source§

fn try_get_i32_le(&mut self) -> Result<i32, TryGetError>

Gets a signed 32 bit integer from self in little-endian byte order. Read more
Source§

fn try_get_i32_ne(&mut self) -> Result<i32, TryGetError>

Gets a signed 32 bit integer from self in native-endian byte order. Read more
Source§

fn try_get_u64(&mut self) -> Result<u64, TryGetError>

Gets an unsigned 64 bit integer from self in big-endian byte order. Read more
Source§

fn try_get_u64_le(&mut self) -> Result<u64, TryGetError>

Gets an unsigned 64 bit integer from self in little-endian byte order. Read more
Source§

fn try_get_u64_ne(&mut self) -> Result<u64, TryGetError>

Gets an unsigned 64 bit integer from self in native-endian byte order. Read more
Source§

fn try_get_i64(&mut self) -> Result<i64, TryGetError>

Gets a signed 64 bit integer from self in big-endian byte order. Read more
Source§

fn try_get_i64_le(&mut self) -> Result<i64, TryGetError>

Gets a signed 64 bit integer from self in little-endian byte order. Read more
Source§

fn try_get_i64_ne(&mut self) -> Result<i64, TryGetError>

Gets a signed 64 bit integer from self in native-endian byte order. Read more
Source§

fn try_get_u128(&mut self) -> Result<u128, TryGetError>

Gets an unsigned 128 bit integer from self in big-endian byte order. Read more
Source§

fn try_get_u128_le(&mut self) -> Result<u128, TryGetError>

Gets an unsigned 128 bit integer from self in little-endian byte order. Read more
Source§

fn try_get_u128_ne(&mut self) -> Result<u128, TryGetError>

Gets an unsigned 128 bit integer from self in native-endian byte order. Read more
Source§

fn try_get_i128(&mut self) -> Result<i128, TryGetError>

Gets a signed 128 bit integer from self in big-endian byte order. Read more
Source§

fn try_get_i128_le(&mut self) -> Result<i128, TryGetError>

Gets a signed 128 bit integer from self in little-endian byte order. Read more
Source§

fn try_get_i128_ne(&mut self) -> Result<i128, TryGetError>

Gets a signed 128 bit integer from self in native-endian byte order. Read more
Source§

fn try_get_uint(&mut self, nbytes: usize) -> Result<u64, TryGetError>

Gets an unsigned n-byte integer from self in big-endian byte order. Read more
Source§

fn try_get_uint_le(&mut self, nbytes: usize) -> Result<u64, TryGetError>

Gets an unsigned n-byte integer from self in little-endian byte order. Read more
Source§

fn try_get_uint_ne(&mut self, nbytes: usize) -> Result<u64, TryGetError>

Gets an unsigned n-byte integer from self in native-endian byte order. Read more
Source§

fn try_get_int(&mut self, nbytes: usize) -> Result<i64, TryGetError>

Gets a signed n-byte integer from self in big-endian byte order. Read more
Source§

fn try_get_int_le(&mut self, nbytes: usize) -> Result<i64, TryGetError>

Gets a signed n-byte integer from self in little-endian byte order. Read more
Source§

fn try_get_int_ne(&mut self, nbytes: usize) -> Result<i64, TryGetError>

Gets a signed n-byte integer from self in native-endian byte order. Read more
Source§

fn try_get_f32(&mut self) -> Result<f32, TryGetError>

Gets an IEEE754 single-precision (4 bytes) floating point number from self in big-endian byte order. Read more
Source§

fn try_get_f32_le(&mut self) -> Result<f32, TryGetError>

Gets an IEEE754 single-precision (4 bytes) floating point number from self in little-endian byte order. Read more
Source§

fn try_get_f32_ne(&mut self) -> Result<f32, TryGetError>

Gets an IEEE754 single-precision (4 bytes) floating point number from self in native-endian byte order. Read more
Source§

fn try_get_f64(&mut self) -> Result<f64, TryGetError>

Gets an IEEE754 double-precision (8 bytes) floating point number from self in big-endian byte order. Read more
Source§

fn try_get_f64_le(&mut self) -> Result<f64, TryGetError>

Gets an IEEE754 double-precision (8 bytes) floating point number from self in little-endian byte order. Read more
Source§

fn try_get_f64_ne(&mut self) -> Result<f64, TryGetError>

Gets an IEEE754 double-precision (8 bytes) floating point number from self in native-endian byte order. Read more
Source§

fn copy_to_bytes(&mut self, len: usize) -> Bytes

Consumes len bytes inside self and returns new instance of Bytes with this data. Read more
Source§

fn take(self, limit: usize) -> Take<Self>
where Self: Sized,

Creates an adaptor which will read at most limit bytes from self. Read more
Source§

fn chain<U>(self, next: U) -> Chain<Self, U>
where U: Buf, Self: Sized,

Creates an adaptor which will chain this buffer with another. Read more
Source§

impl<S: Slice<Item = u8> + Extendable + ?Sized, L: LayoutMut, const UNIQUE: bool> BufMut for ArcSliceMut<S, L, UNIQUE>

Available on crate feature bytes only.
Source§

fn remaining_mut(&self) -> usize

Returns the number of bytes that can be written from the current position until the end of the buffer is reached. Read more
Source§

unsafe fn advance_mut(&mut self, cnt: usize)

Advance the internal cursor of the BufMut Read more
Source§

fn chunk_mut(&mut self) -> &mut UninitSlice

Returns a mutable slice starting at the current BufMut position and of length between 0 and BufMut::remaining_mut(). Note that this can be shorter than the whole remainder of the buffer (this allows non-continuous implementation). Read more
Source§

fn has_remaining_mut(&self) -> bool

Returns true if there is space in self for more bytes. Read more
Source§

fn put<T>(&mut self, src: T)
where T: Buf, Self: Sized,

Transfer bytes into self from src and advance the cursor by the number of bytes written. Read more
Source§

fn put_slice(&mut self, src: &[u8])

Transfer bytes into self from src and advance the cursor by the number of bytes written. Read more
Source§

fn put_bytes(&mut self, val: u8, cnt: usize)

Put cnt bytes val into self. Read more
Source§

fn put_u8(&mut self, n: u8)

Writes an unsigned 8 bit integer to self. Read more
Source§

fn put_i8(&mut self, n: i8)

Writes a signed 8 bit integer to self. Read more
Source§

fn put_u16(&mut self, n: u16)

Writes an unsigned 16 bit integer to self in big-endian byte order. Read more
Source§

fn put_u16_le(&mut self, n: u16)

Writes an unsigned 16 bit integer to self in little-endian byte order. Read more
Source§

fn put_u16_ne(&mut self, n: u16)

Writes an unsigned 16 bit integer to self in native-endian byte order. Read more
Source§

fn put_i16(&mut self, n: i16)

Writes a signed 16 bit integer to self in big-endian byte order. Read more
Source§

fn put_i16_le(&mut self, n: i16)

Writes a signed 16 bit integer to self in little-endian byte order. Read more
Source§

fn put_i16_ne(&mut self, n: i16)

Writes a signed 16 bit integer to self in native-endian byte order. Read more
Source§

fn put_u32(&mut self, n: u32)

Writes an unsigned 32 bit integer to self in big-endian byte order. Read more
Source§

fn put_u32_le(&mut self, n: u32)

Writes an unsigned 32 bit integer to self in little-endian byte order. Read more
Source§

fn put_u32_ne(&mut self, n: u32)

Writes an unsigned 32 bit integer to self in native-endian byte order. Read more
Source§

fn put_i32(&mut self, n: i32)

Writes a signed 32 bit integer to self in big-endian byte order. Read more
Source§

fn put_i32_le(&mut self, n: i32)

Writes a signed 32 bit integer to self in little-endian byte order. Read more
Source§

fn put_i32_ne(&mut self, n: i32)

Writes a signed 32 bit integer to self in native-endian byte order. Read more
Source§

fn put_u64(&mut self, n: u64)

Writes an unsigned 64 bit integer to self in the big-endian byte order. Read more
Source§

fn put_u64_le(&mut self, n: u64)

Writes an unsigned 64 bit integer to self in little-endian byte order. Read more
Source§

fn put_u64_ne(&mut self, n: u64)

Writes an unsigned 64 bit integer to self in native-endian byte order. Read more
Source§

fn put_i64(&mut self, n: i64)

Writes a signed 64 bit integer to self in the big-endian byte order. Read more
Source§

fn put_i64_le(&mut self, n: i64)

Writes a signed 64 bit integer to self in little-endian byte order. Read more
Source§

fn put_i64_ne(&mut self, n: i64)

Writes a signed 64 bit integer to self in native-endian byte order. Read more
Source§

fn put_u128(&mut self, n: u128)

Writes an unsigned 128 bit integer to self in the big-endian byte order. Read more
Source§

fn put_u128_le(&mut self, n: u128)

Writes an unsigned 128 bit integer to self in little-endian byte order. Read more
Source§

fn put_u128_ne(&mut self, n: u128)

Writes an unsigned 128 bit integer to self in native-endian byte order. Read more
Source§

fn put_i128(&mut self, n: i128)

Writes a signed 128 bit integer to self in the big-endian byte order. Read more
Source§

fn put_i128_le(&mut self, n: i128)

Writes a signed 128 bit integer to self in little-endian byte order. Read more
Source§

fn put_i128_ne(&mut self, n: i128)

Writes a signed 128 bit integer to self in native-endian byte order. Read more
Source§

fn put_uint(&mut self, n: u64, nbytes: usize)

Writes an unsigned n-byte integer to self in big-endian byte order. Read more
Source§

fn put_uint_le(&mut self, n: u64, nbytes: usize)

Writes an unsigned n-byte integer to self in the little-endian byte order. Read more
Source§

fn put_uint_ne(&mut self, n: u64, nbytes: usize)

Writes an unsigned n-byte integer to self in the native-endian byte order. Read more
Source§

fn put_int(&mut self, n: i64, nbytes: usize)

Writes low nbytes of a signed integer to self in big-endian byte order. Read more
Source§

fn put_int_le(&mut self, n: i64, nbytes: usize)

Writes low nbytes of a signed integer to self in little-endian byte order. Read more
Source§

fn put_int_ne(&mut self, n: i64, nbytes: usize)

Writes low nbytes of a signed integer to self in native-endian byte order. Read more
Source§

fn put_f32(&mut self, n: f32)

Writes an IEEE754 single-precision (4 bytes) floating point number to self in big-endian byte order. Read more
Source§

fn put_f32_le(&mut self, n: f32)

Writes an IEEE754 single-precision (4 bytes) floating point number to self in little-endian byte order. Read more
Source§

fn put_f32_ne(&mut self, n: f32)

Writes an IEEE754 single-precision (4 bytes) floating point number to self in native-endian byte order. Read more
Source§

fn put_f64(&mut self, n: f64)

Writes an IEEE754 double-precision (8 bytes) floating point number to self in big-endian byte order. Read more
Source§

fn put_f64_le(&mut self, n: f64)

Writes an IEEE754 double-precision (8 bytes) floating point number to self in little-endian byte order. Read more
Source§

fn put_f64_ne(&mut self, n: f64)

Writes an IEEE754 double-precision (8 bytes) floating point number to self in native-endian byte order. Read more
Source§

fn limit(self, limit: usize) -> Limit<Self>
where Self: Sized,

Creates an adaptor which can write at most limit bytes to self. Read more
Source§

fn chain_mut<U>(self, next: U) -> Chain<Self, U>
where U: BufMut, Self: Sized,

Creates an adapter which will chain this buffer with another. Read more
Source§

impl<S: Debug + Slice + ?Sized, L: LayoutMut, const UNIQUE: bool> Debug for ArcSliceMut<S, L, UNIQUE>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<S: Emptyable + ?Sized, L: LayoutMut> Default for ArcSliceMut<S, L>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<S: Slice + ?Sized, L: LayoutMut, const UNIQUE: bool> Deref for ArcSliceMut<S, L, UNIQUE>

Source§

type Target = S

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<S: Slice + ?Sized, L: LayoutMut, const UNIQUE: bool> DerefMut for ArcSliceMut<S, L, UNIQUE>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<'de, S: Slice + Deserializable + ?Sized, L: LayoutMut> Deserialize<'de> for ArcSliceMut<S, L>
where S::Item: for<'a> Deserialize<'a>, S::TryFromSliceError: Display,

Available on crate feature serde only.
Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<S: Display + Slice + ?Sized, L: LayoutMut, const UNIQUE: bool> Display for ArcSliceMut<S, L, UNIQUE>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<S: Slice + ?Sized, L: LayoutMut, const UNIQUE: bool> Drop for ArcSliceMut<S, L, UNIQUE>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<S: Emptyable + Extendable + ?Sized, L: LayoutMut> Extend<<S as Slice>::Item> for ArcSliceMut<S, L>

Available on crate feature oom-handling only.
Source§

fn extend<I: IntoIterator<Item = S::Item>>(&mut self, iter: I)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<T: Copy + Send + Sync + 'static, L: LayoutMut, const N: usize> From<&[T; N]> for ArcSliceMut<[T], L>

Available on crate feature oom-handling only.
Source§

fn from(value: &[T; N]) -> Self

Converts to this type from the input type.
Source§

impl<S: Slice + ?Sized, L: LayoutMut> From<&S> for ArcSliceMut<S, L>
where S::Item: Copy,

Available on crate feature oom-handling only.
Source§

fn from(value: &S) -> Self

Converts to this type from the input type.
Source§

impl<T: Send + Sync + 'static, L: LayoutMut, const N: usize> From<[T; N]> for ArcSliceMut<[T], L>

Available on crate feature oom-handling only.
Source§

fn from(value: [T; N]) -> Self

Converts to this type from the input type.
Source§

impl<T: Send + Sync + 'static, L: AnyBufferLayout + LayoutMut> From<Vec<T>> for ArcSliceMut<[T], L>

Available on crate feature oom-handling only.
Source§

fn from(value: Vec<T>) -> Self

Converts to this type from the input type.
Source§

impl<S: Emptyable + Extendable + ?Sized, L: LayoutMut> FromIterator<<S as Slice>::Item> for ArcSliceMut<S, L>

Available on crate feature oom-handling only.
Source§

fn from_iter<T: IntoIterator<Item = S::Item>>(iter: T) -> Self

Creates a value from an iterator. Read more
Source§

impl<L: LayoutMut> FromStr for ArcSliceMut<str, L>

Available on crate feature oom-handling only.
Source§

type Err = Infallible

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl<S: Hash + Slice + ?Sized, L: LayoutMut, const UNIQUE: bool> Hash for ArcSliceMut<S, L, UNIQUE>

Source§

fn hash<H>(&self, state: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<S: Slice<Item = u8> + ?Sized, L: LayoutMut, const UNIQUE: bool> LowerHex for ArcSliceMut<S, L, UNIQUE>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<S: Ord + Slice + ?Sized, L: LayoutMut, const UNIQUE: bool> Ord for ArcSliceMut<S, L, UNIQUE>

Source§

fn cmp(&self, other: &ArcSliceMut<S, L, UNIQUE>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<'a, T: PartialEq + Send + Sync + 'static, L: LayoutMut, const UNIQUE: bool, const N: usize> PartialEq<&'a [T; N]> for ArcSliceMut<[T], L, UNIQUE>

Source§

fn eq(&self, other: &&'a [T; N]) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a, S: PartialEq + Slice + ?Sized, L: LayoutMut, const UNIQUE: bool> PartialEq<&'a S> for ArcSliceMut<S, L, UNIQUE>

Source§

fn eq(&self, other: &&'a S) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: PartialEq + Send + Sync + 'static, L: LayoutMut, const UNIQUE: bool, const N: usize> PartialEq<[T; N]> for ArcSliceMut<[T], L, UNIQUE>

Source§

fn eq(&self, other: &[T; N]) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: PartialEq + Send + Sync + 'static, L: LayoutMut, const UNIQUE: bool> PartialEq<ArcSliceMut<[T], L, UNIQUE>> for [T]

Source§

fn eq(&self, other: &ArcSliceMut<[T], L, UNIQUE>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: PartialEq + Send + Sync + 'static, L: LayoutMut, const UNIQUE: bool, const N: usize> PartialEq<ArcSliceMut<[T], L, UNIQUE>> for [T; N]

Source§

fn eq(&self, other: &ArcSliceMut<[T], L, UNIQUE>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: PartialEq + Send + Sync + 'static, L: LayoutMut, const UNIQUE: bool> PartialEq<ArcSliceMut<[T], L, UNIQUE>> for Vec<T>

Source§

fn eq(&self, other: &ArcSliceMut<[T], L, UNIQUE>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<L: LayoutMut, const UNIQUE: bool> PartialEq<ArcSliceMut<str, L, UNIQUE>> for String

Source§

fn eq(&self, other: &ArcSliceMut<str, L, UNIQUE>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<L: LayoutMut, const UNIQUE: bool> PartialEq<ArcSliceMut<str, L, UNIQUE>> for str

Source§

fn eq(&self, other: &ArcSliceMut<str, L, UNIQUE>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<S: PartialEq + Slice + ?Sized, L: LayoutMut, const UNIQUE: bool> PartialEq<S> for ArcSliceMut<S, L, UNIQUE>

Source§

fn eq(&self, other: &S) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<L: LayoutMut, const UNIQUE: bool> PartialEq<String> for ArcSliceMut<str, L, UNIQUE>

Source§

fn eq(&self, other: &String) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: PartialEq + Send + Sync + 'static, L: LayoutMut, const UNIQUE: bool> PartialEq<Vec<T>> for ArcSliceMut<[T], L, UNIQUE>

Source§

fn eq(&self, other: &Vec<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<S: PartialEq + Slice + ?Sized, L: LayoutMut, const UNIQUE: bool> PartialEq for ArcSliceMut<S, L, UNIQUE>

Source§

fn eq(&self, other: &ArcSliceMut<S, L, UNIQUE>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<S: PartialOrd + Slice + ?Sized, L: LayoutMut, const UNIQUE: bool> PartialOrd for ArcSliceMut<S, L, UNIQUE>

Source§

fn partial_cmp(&self, other: &ArcSliceMut<S, L, UNIQUE>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<L: LayoutMut, const UNIQUE: bool> Read for ArcSliceMut<[u8], L, UNIQUE>

Available on crate feature std only.
Source§

fn read(&mut self, buf: &mut [u8]) -> Result<usize>

Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more
1.36.0 · Source§

fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>

Like read, except that it reads into a slice of buffers. Read more
Source§

fn is_read_vectored(&self) -> bool

🔬This is a nightly-only experimental API. (can_vector)
Determines if this Reader has an efficient read_vectored implementation. Read more
1.0.0 · Source§

fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>

Reads all bytes until EOF in this source, placing them into buf. Read more
1.0.0 · Source§

fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>

Reads all bytes until EOF in this source, appending them to buf. Read more
1.6.0 · Source§

fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>

Reads the exact number of bytes required to fill buf. Read more
Source§

fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>

🔬This is a nightly-only experimental API. (read_buf)
Pull some bytes from this source into the specified buffer. Read more
Source§

fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>

🔬This is a nightly-only experimental API. (read_buf)
Reads the exact number of bytes required to fill cursor. Read more
1.0.0 · Source§

fn by_ref(&mut self) -> &mut Self
where Self: Sized,

Creates a “by reference” adaptor for this instance of Read. Read more
1.0.0 · Source§

fn bytes(self) -> Bytes<Self>
where Self: Sized,

Transforms this Read instance to an Iterator over its bytes. Read more
1.0.0 · Source§

fn chain<R>(self, next: R) -> Chain<Self, R>
where R: Read, Self: Sized,

Creates an adapter which will chain this stream with another. Read more
1.0.0 · Source§

fn take(self, limit: u64) -> Take<Self>
where Self: Sized,

Creates an adapter which will read at most limit bytes from it. Read more
Source§

impl<S: Serialize + Slice + ?Sized, L: LayoutMut, const UNIQUE: bool> Serialize for ArcSliceMut<S, L, UNIQUE>

Available on crate feature serde only.
Source§

fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error>
where Ser: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<T: Send + Sync + 'static, L: LayoutMut, const N: usize, const UNIQUE: bool> TryFrom<ArcSliceMut<[T], L, UNIQUE>> for [T; N]

Source§

type Error = ArcSliceMut<[T], L, UNIQUE>

The type returned in the event of a conversion error.
Source§

fn try_from(value: ArcSliceMut<[T], L, UNIQUE>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<S: Slice<Item = u8> + ?Sized, L: LayoutMut, const UNIQUE: bool> UpperHex for ArcSliceMut<S, L, UNIQUE>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<L: LayoutMut, const UNIQUE: bool> Write for ArcSliceMut<[u8], L, UNIQUE>

Available on crate feature std only.
Source§

fn write(&mut self, buf: &[u8]) -> Result<usize>

Writes a buffer into this writer, returning how many bytes were written. Read more
Source§

fn flush(&mut self) -> Result<()>

Flushes this output stream, ensuring that all intermediately buffered contents reach their destination. Read more
1.36.0 · Source§

fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> Result<usize, Error>

Like write, except that it writes from a slice of buffers. Read more
Source§

fn is_write_vectored(&self) -> bool

🔬This is a nightly-only experimental API. (can_vector)
Determines if this Writer has an efficient write_vectored implementation. Read more
1.0.0 · Source§

fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>

Attempts to write an entire buffer into this writer. Read more
Source§

fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>

🔬This is a nightly-only experimental API. (write_all_vectored)
Attempts to write multiple buffers into this writer. Read more
1.0.0 · Source§

fn write_fmt(&mut self, args: Arguments<'_>) -> Result<(), Error>

Writes a formatted string into this writer, returning any error encountered. Read more
1.0.0 · Source§

fn by_ref(&mut self) -> &mut Self
where Self: Sized,

Creates a “by reference” adapter for this instance of Write. Read more
Source§

impl<S: Slice<Item = u8> + Extendable + ?Sized, L: LayoutMut, const UNIQUE: bool> Write for ArcSliceMut<S, L, UNIQUE>

Source§

fn write_str(&mut self, s: &str) -> Result

Writes a string slice into this writer, returning whether the write succeeded. Read more
Source§

fn write_fmt(&mut self, args: Arguments<'_>) -> Result

Glue for usage of the write! macro with implementors of this trait. Read more
1.1.0 · Source§

fn write_char(&mut self, c: char) -> Result<(), Error>

Writes a char into this writer, returning whether the write succeeded. Read more
Source§

impl<L: LayoutMut, const UNIQUE: bool> Write for ArcSliceMut<str, L, UNIQUE>

Source§

fn write_str(&mut self, s: &str) -> Result

Writes a string slice into this writer, returning whether the write succeeded. Read more
Source§

fn write_fmt(&mut self, args: Arguments<'_>) -> Result

Glue for usage of the write! macro with implementors of this trait. Read more
1.1.0 · Source§

fn write_char(&mut self, c: char) -> Result<(), Error>

Writes a char into this writer, returning whether the write succeeded. Read more
Source§

impl<S: PartialEq + Slice + ?Sized, L: LayoutMut, const UNIQUE: bool> Eq for ArcSliceMut<S, L, UNIQUE>

Source§

impl<S: Slice + ?Sized, L: LayoutMut, const UNIQUE: bool> Send for ArcSliceMut<S, L, UNIQUE>

Source§

impl<S: Slice + ?Sized, L: AnyBufferLayout + LayoutMut, const UNIQUE: bool> Sync for ArcSliceMut<S, L, UNIQUE>

Auto Trait Implementations§

§

impl<S, L, const UNIQUE: bool> Freeze for ArcSliceMut<S, L, UNIQUE>
where S: ?Sized,

§

impl<S, L, const UNIQUE: bool> RefUnwindSafe for ArcSliceMut<S, L, UNIQUE>
where L: RefUnwindSafe, <S as Slice>::Item: RefUnwindSafe, S: ?Sized,

§

impl<S, L, const UNIQUE: bool> Unpin for ArcSliceMut<S, L, UNIQUE>
where L: Unpin, S: ?Sized,

§

impl<S, L, const UNIQUE: bool> UnwindSafe for ArcSliceMut<S, L, UNIQUE>
where <S as Slice>::Item: RefUnwindSafe, L: UnwindSafe, S: ?Sized,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,