Skip to main content

ColumnRegistry

Struct ColumnRegistry 

Source
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: bool

Whether to coerce type-conflicting columns to String instead of erroring.

§string_ty: &'a Type

Cached String type AST node, used as the coercion target type.

Implementations§

Source§

impl<'a> ColumnRegistry<'a>

Source

fn new(coerce_to_string: bool, string_ty: &'a Type) -> Self

Create a new empty column registry.

Source

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.

Source

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> 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> SizedTypeProperties for T

Source§

#[doc(hidden)]
const SIZE: usize = _

🔬This is a nightly-only experimental API. (sized_type_properties)
Source§

#[doc(hidden)]
const ALIGN: usize = _

🔬This is a nightly-only experimental API. (sized_type_properties)
Source§

#[doc(hidden)]
const ALIGNMENT: Alignment = _

🔬This is a nightly-only experimental API. (ptr_alignment_type)
Source§

#[doc(hidden)]
const IS_ZST: bool = _

🔬This is a nightly-only experimental API. (sized_type_properties)
true if this type requires no storage. false if its size is greater than zero. Read more
Source§

#[doc(hidden)]
const LAYOUT: Layout = _

🔬This is a nightly-only experimental API. (sized_type_properties)
Source§

#[doc(hidden)]
const MAX_SLICE_LEN: usize = _

🔬This is a nightly-only experimental API. (sized_type_properties)
The largest safe length for a [Self]. 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.

Layout§

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