pub struct OptionRef { /* private fields */ }Expand description
A stage’s declaration that it reads one option type: the option type, with the two operations on it that resolving the read needs and cannot perform on a value whose type is erased (creating the type’s default, and digesting a value).
Needs::option and
LoweringDecl::option
create one per option type a stage or a lowering rule reads. Reads compare
and order by their key, so declaring the same read twice
declares it once. OptionRef::named declares a read of an option type
declared from data.
Implementations§
Source§impl OptionRef
impl OptionRef
Sourcepub fn named(name: impl Into<Name>) -> OptionRef
pub fn named(name: impl Into<Name>) -> OptionRef
The declaration of a read of the option type declared from data under
the name name; the read resolves to a DataValue, the empty map
when no value is set.
Sourcepub fn make_default(&self) -> Arc<dyn Any + Send + Sync> ⓘ
pub fn make_default(&self) -> Arc<dyn Any + Send + Sync> ⓘ
A new default value of the option type, with its type erased: what a read resolves to when no value is set on the render request or on the document.
Sourcepub fn digest(&self, value: &(dyn Any + Send + Sync)) -> u64
pub fn digest(&self, value: &(dyn Any + Send + Sync)) -> u64
The digest of value: digest_of applied through the option type’s
Hash implementation. The same value gives the same number in every
process.
§Panics
Panics if value is not a value of this read’s option type. The
library always passes a value of the matching type, so no document can
cause this panic.
Trait Implementations§
impl Eq for OptionRef
Source§impl JsonSchema for OptionRef
Describes an option reference in a JSON schema as a string, the form
Serialize writes.
impl JsonSchema for OptionRef
Describes an option reference in a JSON schema as a string, the form
Serialize writes.
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§impl Ord for OptionRef
impl Ord for OptionRef
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 PartialOrd for OptionRef
impl PartialOrd for OptionRef
Source§impl Serialize for OptionRef
Writes an option reference to data as the name of the option type it
refers to (OptionKey::short_name); see serialized
forms.
impl Serialize for OptionRef
Writes an option reference to data as the name of the option type it
refers to (OptionKey::short_name); see serialized
forms.
Auto Trait Implementations§
impl Forget for OptionRef
impl Freeze for OptionRef
impl Move for OptionRef
impl RefUnwindSafe for OptionRef
impl Send for OptionRef
impl Sync for OptionRef
impl Unpin for OptionRef
impl UnsafeUnpin for OptionRef
impl UnwindSafe for OptionRef
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
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
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.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more