Trait PackedExtension

Source
pub trait PackedExtension<FS: Field>: PackedField<Scalar: ExtensionField<FS>> {
    type PackedSubfield: PackedField<Scalar = FS>;

Show 16 methods // Required methods fn cast_bases(packed: &[Self]) -> &[Self::PackedSubfield]; fn cast_bases_mut(packed: &mut [Self]) -> &mut [Self::PackedSubfield]; fn cast_exts(packed: &[Self::PackedSubfield]) -> &[Self]; fn cast_exts_mut(packed: &mut [Self::PackedSubfield]) -> &mut [Self]; fn cast_base(self) -> Self::PackedSubfield; fn cast_base_ref(&self) -> &Self::PackedSubfield; fn cast_base_mut(&mut self) -> &mut Self::PackedSubfield; fn cast_ext(base: Self::PackedSubfield) -> Self; fn cast_ext_ref(base: &Self::PackedSubfield) -> &Self; fn cast_ext_mut(base: &mut Self::PackedSubfield) -> &mut Self; // Provided methods fn cast_base_arr<const N: usize>( packed: [Self; N], ) -> [Self::PackedSubfield; N] { ... } fn cast_base_arr_ref<const N: usize>( packed: &[Self; N], ) -> &[Self::PackedSubfield; N] { ... } fn cast_base_arr_mut<const N: usize>( packed: &mut [Self; N], ) -> &mut [Self::PackedSubfield; N] { ... } fn cast_ext_arr<const N: usize>( packed: [Self::PackedSubfield; N], ) -> [Self; N] { ... } fn cast_ext_arr_ref<const N: usize>( packed: &[Self::PackedSubfield; N], ) -> &[Self; N] { ... } fn cast_ext_arr_mut<const N: usize>( packed: &mut [Self::PackedSubfield; N], ) -> &mut [Self; N] { ... }
}
Expand description

Trait represents a relationship between a packed struct of field elements and a packed struct of elements from an extension field.

This trait guarantees that one packed type has the same memory representation as the other, differing only in the scalar type and preserving the order of smaller elements.

This trait relation guarantees that the following iterators yield the same sequence of scalar elements:

use binius_field::{ExtensionField, PackedExtension, PackedField, Field};

fn ext_then_bases<'a, F, PE>(packed: &'a PE) -> impl Iterator<Item=F> + 'a
    where
        PE: PackedField<Scalar: ExtensionField<F>>,
        F: Field,
{
    packed.iter().flat_map(|ext| ext.into_iter_bases())
}

fn cast_then_iter<'a, F, PE>(packed: &'a PE) -> impl Iterator<Item=F> + 'a
    where
        PE: PackedExtension<F>,
        F: Field,
{
    PE::cast_base_ref(packed).into_iter()
}

§Safety

In order for the above relation to be guaranteed, the memory representation of PackedExtensionField element must be the same as a slice of the underlying PackedField element.

Required Associated Types§

Required Methods§

Source

fn cast_bases(packed: &[Self]) -> &[Self::PackedSubfield]

Source

fn cast_bases_mut(packed: &mut [Self]) -> &mut [Self::PackedSubfield]

Source

fn cast_exts(packed: &[Self::PackedSubfield]) -> &[Self]

Source

fn cast_exts_mut(packed: &mut [Self::PackedSubfield]) -> &mut [Self]

Source

fn cast_base(self) -> Self::PackedSubfield

Source

fn cast_base_ref(&self) -> &Self::PackedSubfield

Source

fn cast_base_mut(&mut self) -> &mut Self::PackedSubfield

Source

fn cast_ext(base: Self::PackedSubfield) -> Self

Source

fn cast_ext_ref(base: &Self::PackedSubfield) -> &Self

Source

fn cast_ext_mut(base: &mut Self::PackedSubfield) -> &mut Self

Provided Methods§

Source

fn cast_base_arr<const N: usize>(packed: [Self; N]) -> [Self::PackedSubfield; N]

Source

fn cast_base_arr_ref<const N: usize>( packed: &[Self; N], ) -> &[Self::PackedSubfield; N]

Source

fn cast_base_arr_mut<const N: usize>( packed: &mut [Self; N], ) -> &mut [Self::PackedSubfield; N]

Source

fn cast_ext_arr<const N: usize>(packed: [Self::PackedSubfield; N]) -> [Self; N]

Source

fn cast_ext_arr_ref<const N: usize>( packed: &[Self::PackedSubfield; N], ) -> &[Self; N]

Source

fn cast_ext_arr_mut<const N: usize>( packed: &mut [Self::PackedSubfield; N], ) -> &mut [Self; N]

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl PackedExtension<AESTowerField8b> for ByteSlicedAES16x8b

Source§

impl PackedExtension<AESTowerField8b> for ByteSlicedAES16x16b

Source§

impl PackedExtension<AESTowerField8b> for ByteSlicedAES16x32b

Source§

impl PackedExtension<AESTowerField8b> for ByteSlicedAES16x64b

Source§

impl PackedExtension<AESTowerField8b> for ByteSlicedAES16x128b

Source§

impl PackedExtension<AESTowerField8b> for ByteSlicedAES32x8b

Source§

impl PackedExtension<AESTowerField8b> for ByteSlicedAES32x16b

Source§

impl PackedExtension<AESTowerField8b> for ByteSlicedAES32x32b

Source§

impl PackedExtension<AESTowerField8b> for ByteSlicedAES32x64b

Source§

impl PackedExtension<AESTowerField8b> for ByteSlicedAES32x128b

Source§

impl PackedExtension<AESTowerField8b> for ByteSlicedAES64x8b

Source§

impl PackedExtension<AESTowerField8b> for ByteSlicedAES64x16b

Source§

impl PackedExtension<AESTowerField8b> for ByteSlicedAES64x32b

Source§

impl PackedExtension<AESTowerField8b> for ByteSlicedAES64x64b

Source§

impl PackedExtension<AESTowerField8b> for ByteSlicedAES64x128b

Source§

impl PackedExtension<AESTowerField16b> for ByteSlicedAES16x16b

Source§

impl PackedExtension<AESTowerField16b> for ByteSlicedAES32x16b

Source§

impl PackedExtension<AESTowerField16b> for ByteSlicedAES64x16b

Source§

impl PackedExtension<AESTowerField32b> for ByteSlicedAES16x32b

Source§

impl PackedExtension<AESTowerField32b> for ByteSlicedAES32x32b

Source§

impl PackedExtension<AESTowerField32b> for ByteSlicedAES64x32b

Source§

impl PackedExtension<AESTowerField64b> for ByteSlicedAES16x64b

Source§

impl PackedExtension<AESTowerField64b> for ByteSlicedAES32x64b

Source§

impl PackedExtension<AESTowerField64b> for ByteSlicedAES64x64b

Source§

impl PackedExtension<AESTowerField128b> for ByteSlicedAES16x128b

Source§

impl PackedExtension<AESTowerField128b> for ByteSlicedAES32x128b

Source§

impl PackedExtension<AESTowerField128b> for ByteSlicedAES64x128b

Source§

impl<PT, FS> PackedExtension<FS> for PT
where FS: Field, PT: PackedField<Scalar: ExtensionField<FS>> + WithUnderlier<Underlier: PackScalar<FS>>,