pub enum Attested<T> {
Known(T),
AbsentFromWork,
Unknown,
}Expand description
What is known about one field of a Reference.
See the module documentation for why the absent and unknown cases are
separate variants rather than one Option.
Deliberately not #[non_exhaustive]. The three states are the model, and
the defect this type exists to prevent is precisely a caller folding two of
them into one arm. Closing the set makes every consumer’s match a compile
error the day a fourth epistemic state is proposed — which is when that
proposal should be argued, rather than absorbed by a wildcard.
Variants§
Known(T)
We hold the value.
AbsentFromWork
Somebody looked, and the work has none. A renderer may act on this: a
work with no date is cited n.d., a work with no publisher simply omits
that element.
Unknown
Nobody has looked this up. It is not a fact about the work at all — only a record of our own ignorance — and no renderer may turn it into output.
Implementations§
Source§impl<T> Attested<T>
impl<T> Attested<T>
Sourcepub fn is_absent_from_work(&self) -> bool
pub fn is_absent_from_work(&self) -> bool
Whether somebody established that the work has no such value.
Sourcepub fn is_unknown(&self) -> bool
pub fn is_unknown(&self) -> bool
Whether nobody has looked this up.
Trait Implementations§
Source§impl<T> Default for Attested<T>
Attested::Unknown, always.
impl<T> Default for Attested<T>
Attested::Unknown, always.
Implemented by hand rather than derived: #[derive(Default)] would demand
T: Default for no reason, and — more to the point — the default has to be
the state that refuses, so that a record assembled field by field cannot
acquire a citable-looking hole.
Source§impl<'de, T> Deserialize<'de> for Attested<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Attested<T>where
T: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl<T: Eq> Eq for Attested<T>
Source§impl<T: Ord> Ord for Attested<T>
impl<T: Ord> Ord for Attested<T>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<T: PartialOrd> PartialOrd for Attested<T>
impl<T: PartialOrd> PartialOrd for Attested<T>
impl<T: PartialEq> StructuralPartialEq for Attested<T>
Auto Trait Implementations§
impl<T> Freeze for Attested<T>where
T: Freeze,
impl<T> RefUnwindSafe for Attested<T>where
T: RefUnwindSafe,
impl<T> Send for Attested<T>where
T: Send,
impl<T> Sync for Attested<T>where
T: Sync,
impl<T> Unpin for Attested<T>where
T: Unpin,
impl<T> UnsafeUnpin for Attested<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Attested<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.