SmallArcSlice

Struct SmallArcSlice 

Source
pub struct SmallArcSlice<S: Slice<Item = u8> + ?Sized, L: Layout = DefaultLayout>(/* private fields */);
Available on crate feature inlined only.
Expand description

A wrapper enabling small string optimization into ArcSlice.

It can store up to size_of::<ArcBytes<L>>() - 2 bytes inline, without allocating. However, the niche optimization of ArcSlice is lost, which means that size_of::<Option<SmallArcBytes<L>>>() == size_of::<SmallArcBytes<L>>() + size_of::<usize>().

Implementations§

Source§

impl<S: Slice<Item = u8> + ?Sized, L: Layout> SmallArcSlice<S, L>

Source

pub const fn new() -> Self

Creates a new empty SmallArcSlice.

§Examples
use arc_slice::inlined::SmallArcSlice;

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

pub fn from_slice(slice: &S) -> Self

Available on crate feature oom-handling only.

Creates a new SmallArcSlice by copying the given slice.

The slice will be stored inlined if it can fit into a SmallSlice.

§Panics

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

§Examples
use arc_slice::inlined::SmallArcSlice;

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

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

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

The slice will be stored inlined if it can fit into a SmallSlice.

§Examples
use arc_slice::inlined::SmallArcSlice;

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

pub fn as_either(&self) -> Either<&SmallSlice<S, L>, &ArcSlice<S, L>>

Returns either a reference to the inlined SmallSlice storage, or to the ArcSlice one.

§Examples
use arc_slice::inlined::SmallArcSlice;
use either::Either;

let s = SmallArcSlice::<[u8]>::new();
assert!(matches!(s.as_either(), Either::Left(_)));

let s = SmallArcSlice::<[u8]>::from_array([0; 256]);
assert!(matches!(s.as_either(), Either::Right(_)));
Source

pub fn as_either_mut( &mut self, ) -> Either<&mut SmallSlice<S, L>, &mut ArcSlice<S, L>>

Returns either a mutable reference to the inlined SmallSlice storage, or to the ArcSlice one.

§Examples
use arc_slice::inlined::SmallArcSlice;
use either::Either;

let mut s = SmallArcSlice::<[u8]>::new();
assert!(matches!(s.as_either_mut(), Either::Left(_)));

let mut s = SmallArcSlice::<[u8]>::from_array([0; 256]);
assert!(matches!(s.as_either_mut(), Either::Right(_)));
Source

pub fn into_either(self) -> Either<SmallSlice<S, L>, ArcSlice<S, L>>

Returns either the inlined SmallSlice storage, or the ArcSlice one.

Source

pub fn len(&self) -> usize

Returns the number of items in the slice.

§Examples
use arc_slice::inlined::SmallArcSlice;

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

pub fn is_empty(&self) -> bool

Returns true if the slice contains no items.

§Examples
use arc_slice::inlined::SmallArcSlice;

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

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

pub fn as_ptr(&self) -> *const u8

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

See slice::as_ptr.

Source

pub fn try_clone(&self) -> Result<Self, AllocError>

Tries cloning the SmallArcSlice, returning an error if an allocation fails.

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

§Examples
use arc_slice::inlined::SmallArcSlice;

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

pub fn try_subslice( &self, range: impl RangeBounds<usize>, ) -> Result<Self, AllocError>
where S: Subsliceable,

Tries extracting a subslice of an SmallArcSlice with a given range, returning an error if an allocation fails.

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

§Examples
use arc_slice::inlined::SmallArcSlice;

let s = SmallArcSlice::<[u8]>::try_from_slice(b"hello world")?;
let s2 = s.try_subslice(..5)?;
assert_eq!(s2, b"hello");
Source§

impl<L: Layout> SmallArcSlice<[u8], L>

Source

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

Available on crate feature oom-handling only.

Creates a new SmallArcSlice by moving the given array.

§Panics

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

§Examples
use arc_slice::inlined::SmallArcSlice;

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

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

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

§Examples
use arc_slice::inlined::SmallArcSlice;

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

impl<S: Slice<Item = u8> + ?Sized, L: Layout> SmallArcSlice<S, L>

Source

pub fn subslice(&self, range: impl RangeBounds<usize>) -> Self
where S: Subsliceable,

Extracts a subslice of an SmallArcSlice with a given range.

§Examples
use arc_slice::inlined::SmallArcSlice;

let s = SmallArcSlice::<[u8]>::from_slice(b"hello world");
let s2 = s.subslice(..5);
assert_eq!(s2, b"hello");
Source§

impl<L: StaticLayout> SmallArcSlice<[u8], L>

Source

pub const fn from_static(slice: &'static [u8]) -> SmallArcSlice<[u8], L>

Creates a new SmallArcSlice from a static slice.

The operation never allocates.

§Examples
use arc_slice::{inlined::SmallArcSlice, layout::ArcLayout};

static HELLO_WORLD: SmallArcSlice<[u8], ArcLayout<true, true>> =
    SmallArcSlice::<[u8], ArcLayout<true, true>>::from_static(b"hello world");
Source§

impl<L: StaticLayout> SmallArcSlice<str, L>

Source

pub const fn from_static(slice: &'static str) -> SmallArcSlice<str, L>

Creates a new SmallArcSlice from a static slice.

The operation never allocates.

§Examples
use arc_slice::{inlined::SmallArcSlice, layout::ArcLayout};

static HELLO_WORLD: SmallArcSlice<[u8], ArcLayout<true, true>> =
    SmallArcSlice::<[u8], ArcLayout<true, true>>::from_static(b"hello world");

Trait Implementations§

Source§

impl<S: Slice<Item = u8> + ?Sized, L: Layout> AsRef<S> for SmallArcSlice<S, L>

Source§

fn as_ref(&self) -> &S

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

impl<S: Slice<Item = u8> + ?Sized, L: Layout> Borrow<S> for SmallArcSlice<S, L>

Source§

fn borrow(&self) -> &S

Immutably borrows from an owned value. Read more
Source§

impl<S: Slice<Item = u8> + Subsliceable + ?Sized, L: Layout> Buf for SmallArcSlice<S, L>

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> + ?Sized, L: Layout> Clone for SmallArcSlice<S, L>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<S: Debug + Slice<Item = u8> + ?Sized, L: Layout> Debug for SmallArcSlice<S, L>

Source§

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

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

impl<S: Emptyable<Item = u8> + ?Sized, L: Layout> Default for SmallArcSlice<S, L>

Source§

fn default() -> Self

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

impl<S: Slice<Item = u8> + ?Sized, L: Layout> Deref for SmallArcSlice<S, L>

Source§

type Target = S

The resulting type after dereferencing.
Source§

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

Dereferences the value.
Source§

impl<'de, S: Slice<Item = u8> + Deserializable + ?Sized, L: LayoutMut> Deserialize<'de> for SmallArcSlice<S, L>

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<Item = u8> + ?Sized, L: Layout> Display for SmallArcSlice<S, L>

Source§

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

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

impl<S: Slice<Item = u8> + ?Sized, L: Layout> Drop for SmallArcSlice<S, L>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<L: AnyBufferLayout, const N: usize> From<&[u8; N]> for SmallArcSlice<[u8], L>

Available on crate feature oom-handling only.
Source§

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

Converts to this type from the input type.
Source§

impl<S: Slice<Item = u8> + ?Sized, L: AnyBufferLayout> From<&S> for SmallArcSlice<S, L>

Available on crate feature oom-handling only.
Source§

fn from(value: &S) -> Self

Converts to this type from the input type.
Source§

impl<L: AnyBufferLayout, const N: usize> From<[u8; N]> for SmallArcSlice<[u8], L>

Available on crate feature oom-handling only.
Source§

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

Converts to this type from the input type.
Source§

impl<S: Slice<Item = u8> + ?Sized, L: Layout> From<ArcSlice<S, L>> for SmallArcSlice<S, L>

Source§

fn from(value: ArcSlice<S, L>) -> Self

Converts to this type from the input type.
Source§

impl<S: Slice<Item = u8> + ?Sized, L: AnyBufferLayout> From<Box<S>> for SmallArcSlice<S, L>

Available on crate feature oom-handling only.
Source§

fn from(value: Box<S>) -> Self

Converts to this type from the input type.
Source§

impl<S: Slice<Item = u8> + ?Sized, L: Layout> From<SmallSlice<S, L>> for SmallArcSlice<S, L>

Source§

fn from(value: SmallSlice<S, L>) -> Self

Converts to this type from the input type.
Source§

impl<L: AnyBufferLayout> From<String> for SmallArcSlice<str, L>

Available on crate feature oom-handling only.
Source§

fn from(value: String) -> Self

Converts to this type from the input type.
Source§

impl<L: AnyBufferLayout> From<Vec<u8>> for SmallArcSlice<[u8], L>

Available on crate feature oom-handling only.
Source§

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

Converts to this type from the input type.
Source§

impl<L: Layout> FromStr for SmallArcSlice<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<Item = u8> + ?Sized, L: Layout> Hash for SmallArcSlice<S, L>

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: Layout> LowerHex for SmallArcSlice<S, L>

Source§

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

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

impl<S: Ord + Slice<Item = u8> + ?Sized, L: Layout> Ord for SmallArcSlice<S, L>

Source§

fn cmp(&self, other: &SmallArcSlice<S, L>) -> 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, L: Layout, const N: usize> PartialEq<&'a [u8; N]> for SmallArcSlice<[u8], L>

Source§

fn eq(&self, other: &&'a [u8; 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<Item = u8> + ?Sized, L: Layout> PartialEq<&'a S> for SmallArcSlice<S, L>

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<L: Layout, const N: usize> PartialEq<[u8; N]> for SmallArcSlice<[u8], L>

Source§

fn eq(&self, other: &[u8; 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<S: PartialEq + Slice<Item = u8> + ?Sized, L: Layout> PartialEq<S> for SmallArcSlice<S, L>

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: Layout> PartialEq<SmallArcSlice<[u8], L>> for [u8]

Source§

fn eq(&self, other: &SmallArcSlice<[u8], L>) -> 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: Layout, const N: usize> PartialEq<SmallArcSlice<[u8], L>> for [u8; N]

Source§

fn eq(&self, other: &SmallArcSlice<[u8], L>) -> 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: Layout> PartialEq<SmallArcSlice<[u8], L>> for Vec<u8>

Source§

fn eq(&self, other: &SmallArcSlice<[u8], L>) -> 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: Layout> PartialEq<SmallArcSlice<str, L>> for String

Source§

fn eq(&self, other: &SmallArcSlice<str, L>) -> 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: Layout> PartialEq<SmallArcSlice<str, L>> for str

Source§

fn eq(&self, other: &SmallArcSlice<str, L>) -> 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: Layout> PartialEq<String> for SmallArcSlice<str, L>

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<L: Layout> PartialEq<Vec<u8>> for SmallArcSlice<[u8], L>

Source§

fn eq(&self, other: &Vec<u8>) -> 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<Item = u8> + ?Sized, L: Layout> PartialEq for SmallArcSlice<S, L>

Source§

fn eq(&self, other: &SmallArcSlice<S, L>) -> 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<Item = u8> + ?Sized, L: Layout> PartialOrd for SmallArcSlice<S, L>

Source§

fn partial_cmp(&self, other: &SmallArcSlice<S, L>) -> 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<S: Serialize + Slice<Item = u8> + ?Sized, L: Layout> Serialize for SmallArcSlice<S, L>

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<S: Slice<Item = u8> + ?Sized, L: Layout> UpperHex for SmallArcSlice<S, L>

Source§

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

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

impl<S: PartialEq + Slice<Item = u8> + ?Sized, L: Layout> Eq for SmallArcSlice<S, L>

Auto Trait Implementations§

§

impl<S, L> Freeze for SmallArcSlice<S, L>
where <L as InlinedLayout>::Data: Freeze, <L as ArcSliceLayout>::Data: Freeze, S: ?Sized,

§

impl<S, L> RefUnwindSafe for SmallArcSlice<S, L>
where <L as InlinedLayout>::Data: RefUnwindSafe, S: RefUnwindSafe + ?Sized, <L as ArcSliceLayout>::Data: RefUnwindSafe,

§

impl<S, L> Send for SmallArcSlice<S, L>
where <L as InlinedLayout>::Data: Send, S: ?Sized,

§

impl<S, L> Sync for SmallArcSlice<S, L>
where <L as InlinedLayout>::Data: Sync, S: ?Sized,

§

impl<S, L> Unpin for SmallArcSlice<S, L>
where <L as InlinedLayout>::Data: Unpin, S: Unpin + ?Sized, <L as ArcSliceLayout>::Data: Unpin,

§

impl<S, L> UnwindSafe for SmallArcSlice<S, L>
where <L as InlinedLayout>::Data: UnwindSafe, S: UnwindSafe + ?Sized, <L as ArcSliceLayout>::Data: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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>,