Skip to main content

ArrayFactory

Enum ArrayFactory 

Source
pub enum ArrayFactory<const A: usize, const N: usize> {}
Expand description

A type-level factory for creating aligned arrays based on alignment requirements.

This zero-sized type uses const generics to select the appropriate underlying array type (U8Array, U16Array, U32Array, or U64Array) based on the alignment requirement A and the number of elements N.

§Type Parameters

  • A - The required alignment in bytes (1, 2, 4, or 8).
  • N - The number of elements in the array.

§Examples

use ostd_pod::array_helper::{ArrayFactory, ArrayManufacture};

// Creates a `U32Array<8>` (8 `u32` elements with 4-byte alignment)
type MyArray = <ArrayFactory<4, 8> as ArrayManufacture>::Array;

Trait Implementations§

Source§

impl<const N: usize> ArrayManufacture for ArrayFactory<1, N>

Source§

type Array = U8Array<N>

The aligned array type produced by this factory.
Source§

impl<const N: usize> ArrayManufacture for ArrayFactory<2, N>

Source§

type Array = U16Array<N>

The aligned array type produced by this factory.
Source§

impl<const N: usize> ArrayManufacture for ArrayFactory<4, N>

Source§

type Array = U32Array<N>

The aligned array type produced by this factory.
Source§

impl<const N: usize> ArrayManufacture for ArrayFactory<8, N>

Source§

type Array = U64Array<N>

The aligned array type produced by this factory.

Auto Trait Implementations§

§

impl<const A: usize, const N: usize> Freeze for ArrayFactory<A, N>

§

impl<const A: usize, const N: usize> RefUnwindSafe for ArrayFactory<A, N>

§

impl<const A: usize, const N: usize> Send for ArrayFactory<A, N>

§

impl<const A: usize, const N: usize> Sync for ArrayFactory<A, N>

§

impl<const A: usize, const N: usize> Unpin for ArrayFactory<A, N>

§

impl<const A: usize, const N: usize> UnwindSafe for ArrayFactory<A, N>

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, 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.