pub(crate) struct ColumnRegistry<'a> {
pub(crate) columns: Vec<ResolvedColumn>,
pub(crate) col_index: HashMap<String, usize>,
pub(crate) coerce_to_string: bool,
pub(crate) string_ty: &'a Type,
}Expand description
Accumulates unique columns for an enum-to-dataframe unified schema.
As columns are registered from each variant’s fields, the registry detects
duplicates and validates type consistency. When coerce_to_string is enabled,
type conflicts are resolved by coercing to String; otherwise they produce errors.
Fields§
§columns: Vec<ResolvedColumn>The ordered list of resolved columns in the schema.
col_index: HashMap<String, usize>Maps column name strings to their index in columns for O(1) dedup lookup.
coerce_to_string: boolWhether to coerce type-conflicting columns to String instead of erroring.
string_ty: &'a TypeCached String type AST node, used as the coercion target type.
Implementations§
Source§impl<'a> ColumnRegistry<'a>
impl<'a> ColumnRegistry<'a>
Sourcefn new(coerce_to_string: bool, string_ty: &'a Type) -> Self
fn new(coerce_to_string: bool, string_ty: &'a Type) -> Self
Create a new empty column registry.
Sourcefn register(
&mut self,
col_name: &str,
col_ty: &Type,
variant_idx: usize,
variant_name: &Ident,
error_span: Span,
) -> Result<()>
fn register( &mut self, col_name: &str, col_ty: &Type, variant_idx: usize, variant_name: &Ident, error_span: Span, ) -> Result<()>
Register a single column in the schema, or merge with an existing column.
If a column with the same name already exists, validates that the types match.
On type conflict: coerces to String (if coerce_to_string is true) or
returns Err. The variant_idx is appended to the column’s present_in list.
Sourcepub(crate) fn register_factor(
&mut self,
col_name: &str,
col_ty: &Type,
variant_idx: usize,
variant_name: &Ident,
error_span: Span,
) -> Result<()>
pub(crate) fn register_factor( &mut self, col_name: &str, col_ty: &Type, variant_idx: usize, variant_name: &Ident, error_span: Span, ) -> Result<()>
Like register, but marks the column as a factor column (is_factor = true).
Used for fields annotated with #[dataframe(as_factor)]. The companion struct
field type stays Vec<Option<T>>, but into_data_frame wraps it in
FactorOptionVec<T> (using the UnitEnumFactor blanket IntoR impl).
Auto Trait Implementations§
impl<'a> Freeze for ColumnRegistry<'a>
impl<'a> RefUnwindSafe for ColumnRegistry<'a>
impl<'a> !Send for ColumnRegistry<'a>
impl<'a> !Sync for ColumnRegistry<'a>
impl<'a> Unpin for ColumnRegistry<'a>
impl<'a> UnsafeUnpin for ColumnRegistry<'a>
impl<'a> UnwindSafe for ColumnRegistry<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> SizedTypeProperties for T
impl<T> SizedTypeProperties for T
Source§#[doc(hidden)]const SIZE: usize = _
#[doc(hidden)]const SIZE: usize = _
sized_type_properties)Source§#[doc(hidden)]const ALIGN: usize = _
#[doc(hidden)]const ALIGN: usize = _
sized_type_properties)Source§#[doc(hidden)]const ALIGNMENT: Alignment = _
#[doc(hidden)]const ALIGNMENT: Alignment = _
ptr_alignment_type)Source§#[doc(hidden)]const IS_ZST: bool = _
#[doc(hidden)]const IS_ZST: bool = _
sized_type_properties)Source§#[doc(hidden)]const LAYOUT: Layout = _
#[doc(hidden)]const LAYOUT: Layout = _
sized_type_properties)Source§#[doc(hidden)]const MAX_SLICE_LEN: usize = _
#[doc(hidden)]const MAX_SLICE_LEN: usize = _
sized_type_properties)[Self]. Read moreLayout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 88 bytes