Skip to main content

InferenceContext

Struct InferenceContext 

Source
pub struct InferenceContext<'a> {
    pub aliases: &'a BTreeMap<String, String>,
    pub is_matrix_cell: bool,
    pub is_id_column: bool,
    pub prev_row: Option<&'a [Value]>,
    pub column_index: usize,
    pub current_type: Option<&'a str>,
    pub version: (u32, u32),
    pub null_char: char,
    pub expected_type: Option<ExpectedType>,
    pub column_types: Option<&'a [ExpectedType]>,
    pub strict_types: bool,
    pub error_recovery: bool,
    /* private fields */
}
Expand description

Context for value inference.

P0 OPTIMIZATION: Pre-expanded alias cache for 3-4x speedup on alias-heavy documents

Fields§

§aliases: &'a BTreeMap<String, String>

Alias definitions (original BTreeMap - kept for compatibility).

§is_matrix_cell: bool

Whether this is a matrix cell (enables ditto).

§is_id_column: bool

Whether this is the ID column.

§prev_row: Option<&'a [Value]>

Previous row values (for ditto).

§column_index: usize

Column index (for ditto).

§current_type: Option<&'a str>

Current type name (for reference resolution context).

§version: (u32, u32)

HEDL version (for version-specific validation).

§null_char: char

Null literal character (from %NULL directive, defaults to ‘~’).

§expected_type: Option<ExpectedType>

Expected type hint from schema or context.

§column_types: Option<&'a [ExpectedType]>

Column types for matrix rows.

§strict_types: bool

Whether to enforce strict type matching.

§error_recovery: bool

Whether to collect all errors or fail fast.

Implementations§

Source§

impl<'a> InferenceContext<'a>

Source

pub fn for_key_value(aliases: &'a BTreeMap<String, String>) -> Self

Create context for key-value inference.

Source

pub fn for_matrix_cell( aliases: &'a BTreeMap<String, String>, column_index: usize, prev_row: Option<&'a [Value]>, current_type: &'a str, ) -> Self

Create context for matrix cell inference.

Source

pub fn with_version(self, version: (u32, u32)) -> Self

Set the HEDL version for version-specific validation.

Source

pub fn with_expected_type(self, expected: ExpectedType) -> Self

Set expected type hint.

Source

pub fn with_column_types(self, types: &'a [ExpectedType]) -> Self

Set column types for matrix inference.

Source

pub fn with_strict_types(self, strict: bool) -> Self

Enable strict type matching.

Source

pub fn with_error_recovery(self, recovery: bool) -> Self

Enable error recovery mode.

Source

pub fn with_null_char(self, null_char: char) -> Self

Set the null literal character (from %NULL directive).

Auto Trait Implementations§

§

impl<'a> Freeze for InferenceContext<'a>

§

impl<'a> RefUnwindSafe for InferenceContext<'a>

§

impl<'a> Send for InferenceContext<'a>

§

impl<'a> Sync for InferenceContext<'a>

§

impl<'a> Unpin for InferenceContext<'a>

§

impl<'a> UnwindSafe for InferenceContext<'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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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.