Skip to main content

ToExactNaryRelation

Trait ToExactNaryRelation 

Source
pub trait ToExactNaryRelation<T>: ExactSupport<Vec<T>>
where T: Ord + Clone,
{ // Provided method fn to_nary_relation<I, S>( &self, schema: I, ) -> Result<NaryRelation<T>, NaryRelationError> where I: IntoIterator<Item = S>, S: Into<String> { ... } }
Expand description

Shared exact-support and materialization capability traits for add-on relation surfaces. Materializes exact row support as an n-ary relation with an explicit schema.

This trait mirrors the existing to_nary_relation conversion methods on released add-on surfaces. It preserves the current exact n-ary contract: schema names remain explicit and NaryRelation validation rules still apply during materialization.

§Examples

use relmath::{NaryRelation, ToExactNaryRelation, provenance::ProvenanceRelation};

let rows = ProvenanceRelation::from_facts([
    (vec!["Alice", "Math", "passed"], "gradebook"),
    (vec!["Bob", "Physics", "passed"], "gradebook"),
]);

assert_eq!(
    rows.to_nary_relation(["student", "course", "status"])?,
    NaryRelation::from_rows(
        ["student", "course", "status"],
        [["Alice", "Math", "passed"], ["Bob", "Physics", "passed"]],
    )?
);

Provided Methods§

Source

fn to_nary_relation<I, S>( &self, schema: I, ) -> Result<NaryRelation<T>, NaryRelationError>
where I: IntoIterator<Item = S>, S: Into<String>,

Materializes exact row support as an n-ary relation with the given schema.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T, R> ToExactNaryRelation<T> for R
where T: Ord + Clone, R: ExactSupport<Vec<T>>,