pub struct ResolvedOptions { /* private fields */ }Expand description
One stage’s declared option reads, resolved to values.
A run builds one per scheduled stage when it is constructed, so that every
read within the stage returns the same value, and the stage reads the
values through its context
(StageCx::option). A read of an
option type that the stage did not declare returns an error
(OptionError::UndeclaredRead), not the type’s default.
Implementations§
Source§impl ResolvedOptions
impl ResolvedOptions
Sourcepub fn resolve(
stage: StageName,
reads: &[OptionRef],
render: &OptionValues,
document: &OptionValues,
) -> ResolvedOptions
pub fn resolve( stage: StageName, reads: &[OptionRef], render: &OptionValues, document: &OptionValues, ) -> ResolvedOptions
Resolves each read in reads, the declared reads of the stage
stage: to the value set in render if there is one, otherwise the
value set in document if there is one, otherwise the option type’s
default.
This function checks nothing. Check both collections with
validate_values first, so that every value found here is admitted
by its binding.
Sourcepub fn get<T: Options>(&self) -> Result<&T, OptionError>
pub fn get<T: Options>(&self) -> Result<&T, OptionError>
The resolved value of the option type T.
§Errors
Returns OptionError::UndeclaredRead, with the stage and the option
types it declared, when T is not among the stage’s declared reads.
Sourcepub fn get_named(&self, name: &str) -> Result<&Value, OptionError>
pub fn get_named(&self, name: &str) -> Result<&Value, OptionError>
The resolved value of the option type declared from data under the name
name: the data as written, or the empty map when no value is set.
§Errors
Returns OptionError::UndeclaredRead, with the stage, the name and the
option types it declared, when the stage did not declare a read of
name (OptionRef::named).
Sourcepub fn keys(&self) -> impl Iterator<Item = OptionKey> + '_
pub fn keys(&self) -> impl Iterator<Item = OptionKey> + '_
The option types the stage declared, in key order.
Sourcepub fn get_erased(&self, key: &OptionKey) -> Option<&(dyn Any + Send + Sync)>
pub fn get_erased(&self, key: &OptionKey) -> Option<&(dyn Any + Send + Sync)>
The resolved value of the option type key, with its type erased, or
None when the stage did not declare that read.
For a caller that holds a key rather than the Rust type: the lowering
driver returns a lowering rule’s option reads through it
(Lowerer::option_erased),
after checking the read against the rule’s own declaration.
Sourcepub fn digest(&self) -> u64
pub fn digest(&self) -> u64
The digest of the resolved values: the option types and their values, in key order.
It is the same in every process for the same values. The stamp of an
external table (Stamp) includes the digests
of the values that the rewrite stages read, so that data computed with
other option values is not mistaken for data computed with these.
Trait Implementations§
Source§impl Clone for ResolvedOptions
impl Clone for ResolvedOptions
Auto Trait Implementations§
impl !RefUnwindSafe for ResolvedOptions
impl !UnwindSafe for ResolvedOptions
impl Forget for ResolvedOptions
impl Freeze for ResolvedOptions
impl Move for ResolvedOptions
impl Send for ResolvedOptions
impl Sync for ResolvedOptions
impl Unpin for ResolvedOptions
impl UnsafeUnpin for ResolvedOptionswhere
*const ArcInner<str> is !null: UnsafeUnpin,
PhantomData<ArcInner<str>>: UnsafeUnpin,
*const LeafNode<OptionKey, (Arc<dyn Any + Send + Sync>, u64)> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(OptionKey, (Arc<dyn Any + Send + Sync>, u64))>>: UnsafeUnpin,
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<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