Array

Struct Array 

Source
pub struct Array<B, T, Item> { /* private fields */ }

Implementations§

Source§

impl<B, T, Item> Array<B, T, Item>

Source

pub unsafe fn from_raw_parts(data: B, len: usize) -> Array<B, T, Item>

Creates an array from raw parts. This function assumes that data has the number of items specified by len.

§Arguments
  • data: the data buffer.
  • len: the number of items to be read from the buffer.
§Safety

A wrong length could result in UB where the array iterator, getter or setter attempts to slice out of bounds with a future optimization in release builds, currently it will only result in a panic.

Source§

impl<B: AsRef<[u8]>, T, Item: Size> Array<B, T, Item>

Source

pub fn new(data: B) -> Array<B, T, Item>

Source§

impl<B, T, Item> Array<B, T, Item>

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source§

impl<B: AsRef<[u8]>, T, Item> Array<B, T, Item>

Source

pub fn to_ref<Item1>(&self) -> Array<&[u8], T, Item1>

Source§

impl<B: AsRef<[u8]>, T, Item: Size> Array<B, T, Item>

Source

pub fn from_parts(data: B, len: usize) -> Option<Array<B, T, Item>>

Source§

impl<'a, B: AsRef<[u8]>, T, Item: Size> Array<B, T, Item>

Source

pub fn get(&'a self, index: usize) -> Option<&'a [u8]>

Source

pub fn iter(&'a self) -> Chunks<'a, u8>

Source§

impl<'a, B: AsMut<[u8]>, T, Item: Size> Array<B, T, Item>

Source

pub fn get_mut(&'a mut self, index: usize) -> Option<&'a mut [u8]>

Source

pub fn iter_mut(&'a mut self) -> ChunksMut<'a, u8>

Trait Implementations§

Source§

impl<B: Clone, T: Clone, Item: Clone> Clone for Array<B, T, Item>

Source§

fn clone(&self) -> Array<B, T, Item>

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<B: Debug, T: Debug, Item: Debug> Debug for Array<B, T, Item>

Source§

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

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

impl<'a, T: FromBytes<'a, Output: ToUsize>, Item: Size> FromBytes<'a> for Array<&'a [u8], T, Item>

Source§

type Output = Array<&'a [u8], T, Item>

Source§

fn from_bytes(slice: &'a [u8]) -> Result<Message<Self::Output>, Error>

Source§

impl<B: AsRef<[u8]>, T, Item: Size> Index<usize> for Array<B, T, Item>

Source§

type Output = [u8]

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<B: AsRef<[u8]> + AsMut<[u8]>, T, Item: Size> IndexMut<usize> for Array<B, T, Item>

Source§

fn index_mut(&mut self, index: usize) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<B: AsRef<[u8]>, T: WriteTo<Input<'static>: ToUsize>, Item> WriteTo for Array<B, T, Item>

Source§

type Input<'b> = Array<B, T, Item>

Source§

fn write_to<W: Write>(input: &Self::Input<'_>, out: W) -> Result<(), Error>

Source§

impl<B: Copy, T: Copy, Item: Copy> Copy for Array<B, T, Item>

Auto Trait Implementations§

§

impl<B, T, Item> Freeze for Array<B, T, Item>
where B: Freeze,

§

impl<B, T, Item> RefUnwindSafe for Array<B, T, Item>

§

impl<B, T, Item> Send for Array<B, T, Item>
where B: Send, T: Send, Item: Send,

§

impl<B, T, Item> Sync for Array<B, T, Item>
where B: Sync, T: Sync, Item: Sync,

§

impl<B, T, Item> Unpin for Array<B, T, Item>
where B: Unpin, T: Unpin, Item: Unpin,

§

impl<B, T, Item> UnwindSafe for Array<B, T, Item>
where B: UnwindSafe, T: UnwindSafe, Item: 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<'a, H, T> FromBytesWithHeader<'a, H> for T
where T: FromBytes<'a>,

Source§

type Output = <T as FromBytes<'a>>::Output

Source§

fn from_bytes_with_header( slice: &'a [u8], _: &H, ) -> Result<Message<<T as FromBytesWithHeader<'a, H>>::Output>, Error>

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, U> IntoUnion<U> for T
where U: FromValue<T>,

Source§

fn into_union(self) -> U

Source§

impl<H, T> ShapeHeader<H> for T
where T: WriteSelf,

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, 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<'a, T> WriteSelf for T
where T: WriteTo<Input<'a> = T>,

Source§

fn write_self<W>(&self, out: W) -> Result<(), Error>
where W: Write,

Source§

fn size(&self) -> Result<usize, Error>

Source§

impl<H, T> WriteToWithHeader<H> for T
where T: WriteSelf,

Source§

type Input<'b> = T

Source§

fn write_to_with_header<W>( input: &<T as WriteToWithHeader<H>>::Input<'_>, _: &H, out: W, ) -> Result<(), Error>
where W: Write,