Skip to main content

AbsentDefault

Enum AbsentDefault 

Source
pub enum AbsentDefault {
    Stamped(DefaultValue, DocCitation),
    Constructed(DefaultValue, DocCitation),
    NotAConstant(DocCitation),
    Unverified,
}
Expand description

What the engine holds for a label the file does not carry.

The two audited variants describe different engine mechanisms and read differently in a diagnostic, so they stay apart. They behave identically for everything this codebase does with them, because a typed view is always built from bytes and never loaded onto an object that already holds state: there is no prior value for a carry-over to carry. Both therefore reduce to “compare against this constant” for the omit rule and the reader guard, which is why those share one code path over Self::value.

Every variant that claims to know something carries a DocCitation, which is what keeps the axis a record of audited findings rather than a second copy of the reader.

Variants§

§

Stamped(DefaultValue, DocCitation)

The loader stamps this constant whether or not the field was present.

Overwrites whatever the object already held, which is what makes it distinct from Self::Constructed rather than a rewording of it. A placeable’s trap flags are the clear case: the constructor arms all three, and the read stamps 0 over them regardless.

§

Constructed(DefaultValue, DocCitation)

The loader leaves the object’s own value alone; this is what a freshly constructed one holds.

Reporting the mechanism without the value would leave the question open, so the constructed value is part of the answer rather than a footnote to it.

§

NotAConstant(DocCitation)

Audited, and the answer is known, but it is not one constant.

Two shapes land here. The value can be a function of a sibling field: Uti::MaxCharges reuses whatever Charges resolved to, and Utc’s MovementRate and WalkRate each fall back to the other’s label. Or it can be structured rather than scalar: an absent Utc::SkillList leaves eight skill ranks at eight zeroes, which no DefaultValue can hold.

Carries a citation but no encoding of the answer. Encoding a derivation would mean a small expression language in a static table to serve a handful of fields, when the readers already do it in a line or two with the siblings in scope; encoding a structured value would mean a variant per shape. What the schema needs to say is that the value is known, is not a constant, and must never be omitted on write.

Not a synonym for Self::Unverified. Folding these together would throw away an audit, and it would do real damage downstream: the danger list a consumer builds is unverified fields weighted by how often their fallback fires, so filing a known answer as unknown plants a permanent false alarm in the one output that ranking exists to produce.

§

Unverified

Nobody has traced what the engine does without this field.

A terminal state, not a gap to be embarrassed about: it is what lets the audited entries be trusted. A writer must emit an unverified field, since omitting it would bet on a substitution nobody has checked.

The one variant with no citation, because there is nothing to cite.

Implementations§

Source§

impl AbsentDefault

Source

pub fn value(&self) -> Option<DefaultValue>

The constant the engine ends up holding, when it is one.

None for Self::NotAConstant and Self::Unverified, which is what keeps both out of the omit rule and out of the reader guard.

Source

pub fn citation(&self) -> Option<DocCitation>

The audited finding this entry rests on.

None only for Self::Unverified. Every entry that claims to know something says where it learned it.

Trait Implementations§

Source§

impl Clone for AbsentDefault

Source§

fn clone(&self) -> AbsentDefault

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 AbsentDefault

Source§

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

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

impl PartialEq for AbsentDefault

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for AbsentDefault

Source§

impl StructuralPartialEq for AbsentDefault

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> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
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<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
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> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> StrictAs for T

Source§

fn strict_as<Dst>(self) -> Dst
where T: StrictCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> StrictCastFrom<Src> for Dst
where Src: StrictCast<Dst>,

Source§

fn strict_cast_from(src: Src) -> Dst

Casts the value.
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.
Source§

impl<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.