pub struct Schema { /* private fields */ }Expand description
Logical names and lookup tables for four-momentum, scalar, and weight columns.
Implementations§
Source§impl Schema
impl Schema
Sourcepub fn new(
p4s: impl IntoIterator<Item = impl Into<Name>>,
scalars: impl IntoIterator<Item = impl Into<Name>>,
has_weight: bool,
) -> LadduDataResult<Self>
pub fn new( p4s: impl IntoIterator<Item = impl Into<Name>>, scalars: impl IntoIterator<Item = impl Into<Name>>, has_weight: bool, ) -> LadduDataResult<Self>
Validates and constructs a logical schema.
§Errors
Returns LadduDataError when four-momentum or scalar column names are
duplicated.
Sourcepub fn p4_index(&self, name: &str) -> Option<usize>
pub fn p4_index(&self, name: &str) -> Option<usize>
Returns the four-momentum column index for name.
Sourcepub fn scalar_index(&self, name: &str) -> Option<usize>
pub fn scalar_index(&self, name: &str) -> Option<usize>
Returns the scalar column index for name.
Sourcepub fn has_weight(&self) -> bool
pub fn has_weight(&self) -> bool
Returns whether events carry explicit weights.
Sourcepub fn require_p4(&self, name: &str) -> LadduDataResult<usize>
pub fn require_p4(&self, name: &str) -> LadduDataResult<usize>
Requires and returns a four-momentum column index.
§Errors
Returns LadduDataError::MissingColumn when name is not a
four-momentum column.
Sourcepub fn require_scalar(&self, name: &str) -> LadduDataResult<usize>
pub fn require_scalar(&self, name: &str) -> LadduDataResult<usize>
Requires and returns a scalar column index.
§Errors
Returns LadduDataError::MissingColumn when name is not a scalar
column.
Source§impl Schema
impl Schema
Sourcepub fn infer_from_columns<'a>(
columns: impl IntoIterator<Item = ColumnInfo<'a>>,
options: &SchemaInferenceOptions,
) -> LadduDataResult<Self>
pub fn infer_from_columns<'a>( columns: impl IntoIterator<Item = ColumnInfo<'a>>, options: &SchemaInferenceOptions, ) -> LadduDataResult<Self>
Infers a logical schema from available physical columns.
§Errors
Returns LadduDataError when required momentum components or weights
are missing, names are ambiguous, or inferred logical names conflict.
Sourcepub fn physical_columns(&self, column_names: &SchemaColumnNames) -> Vec<Name> ⓘ
pub fn physical_columns(&self, column_names: &SchemaColumnNames) -> Vec<Name> ⓘ
Returns all physical columns required to store this schema.
Sourcepub fn validate_required_columns<'a>(
&self,
available: impl IntoIterator<Item = ColumnInfo<'a>>,
options: &SchemaInferenceOptions,
) -> LadduDataResult<()>
pub fn validate_required_columns<'a>( &self, available: impl IntoIterator<Item = ColumnInfo<'a>>, options: &SchemaInferenceOptions, ) -> LadduDataResult<()>
Validates that all physical columns required by this schema are available.
§Errors
Returns LadduDataError::MissingColumn when a required physical
column is absent or has an unsupported type.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Schema
impl RefUnwindSafe for Schema
impl Send for Schema
impl Sync for Schema
impl Unpin for Schema
impl UnsafeUnpin for Schema
impl UnwindSafe for Schema
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.