Rindle docs and package mapSkip to main content

RelDef

Struct RelDef 

pub struct RelDef {
    pub name: Box<str>,
    pub child: Option<Box<Schema>>,
    pub project: Option<ScalarProjection>,
}
Expand description

A declared outgoing relationship on a table Schema (slot = index in Schema::relationships). Carries the public name the View surfaces (09) and, when known, the target Schema the relationship points at — the hierarchical SourceSchema the production ArrayView (09) navigates to sort child entries. child is None for a join-only RelDef (name resolution alone — the join already holds the child schema separately); the View requires Some.

Fields§

§name: Box<str>

Relationship name. Owned (Box<str>) so a runtime-supplied schema (the JS wasm boundary, WS01.3) can construct it — column/relationship names are not 'static when they arrive from JavaScript. The constructors still accept &str, so &'static str literals at the existing call sites coerce in.

§child: Option<Box<Schema>>

The relationship’s target schema (the child level). None for join-only uses that need name→slot resolution but never feed a View.

§project: Option<ScalarProjection>

When Some, this is a scalar-projected relationship aggregate (REDUCE-DESIGN.md §9): the presentation boundary unwraps the one-row child into a scalar field (see ScalarProjection). None for an ordinary (plural or .one() object) relationship.

Implementations§

§

impl RelDef

pub fn new(name: &str) -> RelDef

A join-only relationship: just a name (no child schema). Used wherever a parent schema declares a relationship purely so a join can resolve its rel_name to a RelId slot (Schema::rel_slot).

pub fn related(name: &str, child: Schema) -> RelDef

A View-facing relationship carrying its target (child) schema.

pub fn project_scalar(self, col: usize, identity: OwnedValue) -> RelDef

Mark this relationship as a scalar-projected aggregate (REDUCE-DESIGN.md §9): the presentation boundary unwraps the one-row child, surfacing child column col as a scalar field (with identity substituted when the relationship is empty). Builder over RelDef::related — the child schema (the synthetic aggregate row) must already be attached.

Trait Implementations§

§

impl Clone for RelDef

§

fn clone(&self) -> RelDef

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for RelDef

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.