binius_field/as_packed_field.rs
1// Copyright 2024-2025 Irreducible Inc.
2
3use crate::{
4 Field, PackedField,
5 underlier::{UnderlierType, WithUnderlier},
6};
7
8/// This trait represents correspondence (UnderlierType, Field) -> PackedField.
9/// For example (u64, BinaryField16b) -> PackedBinaryField4x16b.
10pub trait PackScalar<F: Field>: UnderlierType {
11 type Packed: PackedField<Scalar = F> + WithUnderlier<Underlier = Self>;
12}
13
14/// Returns the packed field type for the scalar field `F` and underlier `U`.
15pub type PackedType<U, F> = <U as PackScalar<F>>::Packed;