Skip to main content

EmissionPrefix

Struct EmissionPrefix 

Source
pub struct EmissionPrefix(/* private fields */);
Expand description

The mark a framework’s emitted names are minted under — __ig for ingraph itself.

§It holds the mark WITHOUT the joining underscore

__ig, not __ig_: the separator belongs to the join rather than to the namespace, because the two shapes this mints — framed and prefixed — place it identically and a mark carrying its own would make one of them spell a double. It is also the shape the FENCE reads: a declared name is refused for starting with the mark, and a fence holding __ig_ would let a column called __ig itself through.

§Cow, because both occupants are real

The framework’s own mark is a &'static str and costs nothing to carry; a front end computing one — from a manifest, or from a domain crate’s own configuration — owns a String. A Cow serves both without making the common case allocate, and INGRAPH is const for the same reason.

Implementations§

Source§

impl EmissionPrefix

Source

pub const INGRAPH: Self

ingraph’s own namespace — the answer every model this repository’s derive builds carries.

It reads crate::alias::ALIAS_PREFIX rather than re-spelling it, so the string lives in one place and the alias mint, the companion column and the injected fields cannot drift apart.

Source

pub fn new(mark: impl Into<Cow<'static, str>>) -> Self

A domain framework’s own mark.

Nothing is checked here: refused is where the rules are, and it is spent by the front end that has a span to report at. A mint that validated would be answering a question its caller has already had to answer — the arrangement crate::alias::alias already keeps one module over.

Source

pub fn mark(&self) -> &str

The mark itself, for the two places that need the bare string: the FENCE a front end holds declared names to, and the alias mint that spends it as a byte budget.

Source

pub fn is_default(&self) -> bool

Whether this is the framework’s own — the question a front end asks about the SEAT.

It is what says this model moved nothing, and it is why a declaration under the default mark expands byte for byte as it did before this seat existed.

§It is NOT the question an emission asks before staying silent

That one is InterfaceModel::mints_the_default_words, and it compares against ingraph’s own constant rather than against this — because what an emission may leave unsaid is decided by what the ENGINE already believes, and the engine holds one default whoever built the model. The two coincide for ingraph’s front ends and part company for a platform’s, which is exactly where the distinction earns its keep.

Source

pub fn framed(&self, word: &str) -> String

__ig_<word>__ — a name in the SYNTHESIZED-COLUMN frame.

The shape a framework-invented FIELD or COLUMN wears: the mark in front and __ behind. Both ends are load-bearing. The front is what a fence refuses a declared name for; the back is what makes the join INJECTIVE, since the word is then everything between two fixed strings and two words cannot reach one name.

A word whose tail looks like _<digits>__ is the one shape this cannot carry — that is the alias mint’s own tail, and a framed word ending in one would be reachable by a join as well. Where a mint is indexed the digits FUSE into the word (__ig_ord0__, never __ig_ord_0__).

Source

pub fn framed_ident(&self, word: &str) -> Ident

framed as an identifier, for the fields and items an expansion writes.

§It cannot be spanned here

The call site sets the span, because a framework-minted name has no source to point at and the span a diagnostic wants is the DECLARATION’s. Every caller today takes Span::call_site, which is what format_ident! gives.

Source

pub fn prefixed(&self, word: &str) -> String

__ig_<word> — a name in the namespace but OUTSIDE the frame.

The shape for a minted ITEM rather than a column: a marker const, a DDL object, an audit function. It wears no tail because there is nothing to keep injective — such a name already ends in a word this crate chose, and the frame is the COLUMN law rather than the namespace’s.

Source

pub fn prefixed_ident(&self, word: &str) -> Ident

prefixed as an identifier, spanned at the call site for framed_ident’s reason.

Source

pub fn refused(mark: &str) -> Option<String>

Why this mark cannot be a namespace, or None where it can.

§The rules are the MINT’s, which is why they live beside it rather than in a front end

A mark is spent in three shapes — a framed column, a prefixed item, and a clamped SQL alias — and what it must be is decided by what those spend it as. A second copy of these rules in whichever crate happens to read the configuration is the copy that drifts the day a mint’s shape moves. What a front end adds is the SPAN: this answers in prose and knows nothing about tokens.

The byte BUDGET is deliberately not here. It is a fact about the alias mint alone — how much of a table’s own name survives PostgreSQL’s sixty-three — and it depends on a depth this seat has never heard of; crate::alias::refused is where the pair is held together.

Trait Implementations§

Source§

impl Clone for EmissionPrefix

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 EmissionPrefix

Source§

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

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

impl Default for EmissionPrefix

Source§

fn default() -> Self

The framework’s own, which is what every ingraph front end passes and what a model built without a thought about namespaces has to be.

Source§

impl Eq for EmissionPrefix

Source§

impl Hash for EmissionPrefix

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for EmissionPrefix

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for EmissionPrefix

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.