Skip to main content

AliasOptions

Struct AliasOptions 

Source
pub struct AliasOptions {
    pub prefix: Option<String>,
    pub depth: Option<usize>,
}
Expand description

<db>(alias(prefix = "__mine", depth = 16)) — one database’s answer about the names its nested scopes mint, in the two states each half has.

§Per DATABASE, because the emitted table already is

ALIASES rides one SqlQuery<Db> impl, so a record stored in two databases already carries two of them; letting the two differ cost nothing that was not already there. And the user story is per database too: one deployment’s schema holds legacy tables inside the default namespace and the others do not, so the override belongs on that database and nowhere else.

§DECLARED-or-not is kept, and the FENCE is what needs it

prefix_in resolves to the MODEL’s own EmissionPrefix where nothing was written, which is what the emission spends. What the fence needs is the other question — whether anything was written at all — because it refuses the union of every DECLARED prefix plus the default wherever a database still defaults. A record that overrode every one of its databases has handed __ig* back to its author, and a model that had already collapsed the absent case into the default could not tell.

§The fallback is the MODEL’s namespace and not this crate’s constant

Two seats, one answer: <db>(alias(prefix = …)) is what a DECLARATION moves, and RecordModel::prefix is what a FRAMEWORK building the model moves. The declaration’s word wins where it is written, and where it is not the answer is the framework’s own mark — so a model mediagraph-codegen built defaults to __mg here, rather than to ingraph’s __ig through a constant that has never heard of it.

Fields§

§prefix: Option<String>

prefix = "…", or None where this database took the default.

§depth: Option<usize>

depth = N, or None where this database took the default.

Implementations§

Source§

impl AliasOptions

Source

pub fn prefix_in<'a>(&'a self, prefix: &'a EmissionPrefix) -> &'a str

The namespace this database’s names are minted in — its own, or the framework’s.

prefix is the model’s, so an absent prefix = "…" resolves to whichever framework built this declaration rather than to a constant. Every name minted FOR one database goes through here: the row aliases, and the companion column beside them.

Source

pub fn depth(&self) -> usize

How many depths this database’s aliases are minted for — its own, or the framework’s.

Trait Implementations§

Source§

impl Clone for AliasOptions

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for AliasOptions

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for AliasOptions

Source§

fn default() -> Self

Returns the “default value” for a type. 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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.