pub struct Cascade<O: CascadeOrigin> { /* private fields */ }Expand description
The settings written in every source, each value with its origin, combined by the rule of the ranks when they are read. See the module documentation.
The host records every value written (set,
switch_off, switch_on,
set_parsing,
add_workflow_fields), in any order, then
reads the result with read,
parsing and workflows.
Implementations§
Source§impl<O: CascadeOrigin> Cascade<O>
impl<O: CascadeOrigin> Cascade<O>
Sourcepub fn new() -> Cascade<O>
pub fn new() -> Cascade<O>
Returns an empty cascade in which no package reaches another, so that every two packages are peers.
Sourcepub fn with_reach(reach: Reach) -> Cascade<O>
pub fn with_reach(reach: Reach) -> Cascade<O>
Returns an empty cascade in which the packages reach one another as
reach says: a package wins over the packages it reaches, for every
setting both write. See the module
documentation.
Sourcepub fn set(&mut self, feature: &str, key: &str, value: Value, origin: O)
pub fn set(&mut self, feature: &str, key: &str, value: Value, origin: O)
Records value for the key key of the feature feature, written at
origin. Every value recorded is kept; the rule of the ranks decides
which one results when the settings are read, and
read reports peers that disagree. It does not switch
the feature on.
Sourcepub fn switch_off(&mut self, feature: &str, origin: O)
pub fn switch_off(&mut self, feature: &str, origin: O)
Records that origin switches the feature feature off; the keys its
source sets for the feature are recorded apart, with Cascade::set,
and are not read while the feature is off. The rule of the ranks decides
between the sources that switch the feature on or off.
Sourcepub fn switch_on(&mut self, feature: &str, origin: O)
pub fn switch_on(&mut self, feature: &str, origin: O)
Records that origin switches the feature feature on; the keys its
source sets for the feature are recorded apart, with Cascade::set.
The rule of the ranks decides between the sources that switch the
feature on or off.
Sourcepub fn set_parsing(&mut self, key: &str, value: Value, origin: O)
pub fn set_parsing(&mut self, key: &str, value: Value, origin: O)
Records value for the parsing setting key (FlmParsing), written
at origin; the parsing settings are combined key by key by the rule of
the ranks (parsing).
Sourcepub fn add_workflow_fields(
&mut self,
workflow: &str,
fields: impl IntoIterator<Item = (String, Value, O)>,
)
pub fn add_workflow_fields( &mut self, workflow: &str, fields: impl IntoIterator<Item = (String, Value, O)>, )
Records fields, the fields that a package writes for the workflow
workflow: each a field’s name, its value and its origin. With no
field, it records the workflow alone (a package that gives the workflow
settings only). The rule of the ranks decides between the packages that
write one field, and read reports peers that
disagree.
Sourcepub fn value(&self, feature: &str, key: &str) -> Option<SettingValue<O>>
pub fn value(&self, feature: &str, key: &str) -> Option<SettingValue<O>>
Returns the resulting value of the key key of the feature feature,
combined whole, with its origin, if a source wrote one. When peers
disagree, it is the first written. A value marked as combined key by key
is combined so only when the settings are read, which
has the feature’s declaration.
Sourcepub fn switched_off(&self, feature: &str) -> Option<O>
pub fn switched_off(&self, feature: &str) -> Option<O>
Returns where the feature feature was switched off, if the source that
decides its switch switches it off.
Sourcepub fn workflow_field(
&self,
workflow: &str,
field: &str,
) -> Option<SettingValue<O>>
pub fn workflow_field( &self, workflow: &str, field: &str, ) -> Option<SettingValue<O>>
Returns the resulting value of the field field of the workflow
workflow, with its origin, if a package wrote one. When peers
disagree, it is the first written.
Sourcepub fn workflows(&self) -> BTreeMap<String, Vec<(String, SettingValue<O>)>>
pub fn workflows(&self) -> BTreeMap<String, Vec<(String, SettingValue<O>)>>
Returns every workflow that a package writes, with fields or with
settings only, by its name: its resulting fields, each with its name,
value and origin (none for a workflow written with settings only). The
host gives these to the library, once per workflow (workflow_def,
then
RegistryBuilder::workflow_fields),
so they are the fields the workflow runs with.
Sourcepub fn parsing_in_effect(&self) -> BTreeMap<String, SettingValue<O>>
pub fn parsing_in_effect(&self) -> BTreeMap<String, SettingValue<O>>
Returns the resulting value of each parsing setting that a source wrote,
by its key, with its origin: the value that
parsing reads for the key. When peers disagree, it
is the first written. A key that no source wrote is absent.
Sourcepub fn in_effect(
&self,
factories: &[&PackageFactory],
) -> BTreeMap<String, FeatureInEffect<O>>
pub fn in_effect( &self, factories: &[&PackageFactory], ) -> BTreeMap<String, FeatureInEffect<O>>
Returns the settings in effect for the package factories factories,
by the feature’s name: for each feature that a source wrote and that one
of the factories holds, whether it is switched off and where, and the
value in effect of each key written, combined from every source by the
rule of the ranks, with where it was written (FeatureInEffect). A
value marked as combined key by key is combined so, each key with its
origin, at every depth (see the module
documentation), and relative paths are resolved (see the module
documentation). This is the data
that read reads through the features’ settings
declarations, combined by the same code.
A host uses it to show each setting’s value and where it was written.
Nothing is checked: a key that the feature does not declare is listed
like the others, and when peers disagree the value is the first written,
as for value; read reports these
problems. A feature that no factory holds, and the keys of a feature
that takes no settings, are left out.
Sourcepub fn writes_at(
&self,
decl: Option<&SettingsDecl>,
feature: &str,
key: &str,
path: &[&str],
) -> Vec<WriteAt<O>>
pub fn writes_at( &self, decl: Option<&SettingsDecl>, feature: &str, key: &str, path: &[&str], ) -> Vec<WriteAt<O>>
Returns every value that a source wrote at the place path below the
key key of the feature feature (path holds the names of the keys,
outermost first; empty for the key itself), lowest rank first and, within
a rank, in the order written: each write of the key that holds a value
at that place, with that value as written, its origin, and whether it
gives the value in effect there.
The value in effect is decided as in_effect
decides it, by the marks of decl, the declaration in force of the
feature (declaration_in_force, whose off answers whether this
cascade switches a feature off; None for a feature that takes no
settings or that no factory holds): down the path, through each place
combined key by key, to the first place decided whole, where the write
that the rule of the ranks chooses gives the value in effect when it
holds a value at path. No write is in effect at a place combined key
by key (its value is made of several writes), at a place that no source
writes (where the feature’s own default is in effect), nor in a feature
switched off, without settings, or that no factory holds. When peers
disagree, the first written is in effect, as for
value. A host that lists the writes at several
places of one feature computes the declaration once.
Sourcepub fn decided_at(
&self,
decl: Option<&SettingsDecl>,
feature: &str,
key: &str,
path: &[&str],
) -> Option<DecidedAt<O>>
pub fn decided_at( &self, decl: Option<&SettingsDecl>, feature: &str, key: &str, path: &[&str], ) -> Option<DecidedAt<O>>
Returns the place decided whole that holds the place path below the
key key of the feature feature (as for
writes_at, whose decl it takes too): the
first place, down the path through each place combined key by key, that
is not combined so, with the origin of the write that gives its value
by the rule of the ranks, or no origin when no source writes there (the
feature’s own default then gives it, an entry of its default of the
value combined key by key above it when the place lies below the key).
The value at path lies at the place returned or inside it. There is
none when path is itself combined key by key or lies in such a place
along its names, and in a feature switched off, without settings, or
that no factory holds. writes_at lists the
writes there.
Sourcepub fn read(
&self,
factories: &[&PackageFactory],
) -> Result<ReadSettings<O>, ReadFailure<O>>
pub fn read( &self, factories: &[&PackageFactory], ) -> Result<ReadSettings<O>, ReadFailure<O>>
Reads the combined settings through the settings declarations of the
package factories factories: every feature of a factory that declares
settings and is not switched off is read by its declaration, from the
data written for it, or from the empty map when nothing is written under
it (see SettingsDecl::read for the configuration read from the empty
map). Path values are resolved first (see the module
documentation). The data read for
a feature that a source wrote is what in_effect
returns for it.
Every factory gets an entry in ReadSettings::packages, which holds
the settings read of each of its features that declares settings,
written or not; a feature switched off is recorded as such in its
package’s settings. What a source writes for a feature that no factory
holds is read by nothing: each source that writes such a feature gives
one warning (WarningKind::UnknownFeature), at the first origin
recorded for it, and nothing else (see the module
documentation). A key
written under an entry in force that the entry does not declare is left
out of the combined settings, with one warning
(WarningKind::UndeclaredKey) at the origin of each write of it (see
the module documentation).
The warnings are in ReadSettings::warnings, or in
ReadFailure::warnings when the reading finds problems.
§Errors
A ReadFailure with every problem found, each at the origin of the
value at fault, and the warnings found beside them. The problems: settings
written for a feature that takes no settings; peers that disagree on
a key, on a value below one, or on whether a feature is off; a value
that is not an object where the feature’s declaration combines it key
by key (Mark::MergeObjectKeyValues); a key the feature does not
declare, or a value its declaration cannot read; a key that a workflow’s
settings set and that is not set per render request; peers that disagree
on a field of a workflow; an entry that two features in use declare, and
a declaration of an entry at a place that the owner does not open
(SettingsDecl::open_entries); a path in a value marked
Mark::Path that its origin refuses
(CascadeOrigin::resolve_path). A problem found in reading a
feature nothing is written for (a configuration reader that refuses the
empty map), and a fault of the declarations of entries, have no origin.
Trait Implementations§
Auto Trait Implementations§
impl<O> Forget for Cascade<O>
impl<O> Freeze for Cascade<O>where
*const LeafNode<String, FeatureValues<O>> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(String, FeatureValues<O>)>>: Freeze,
*const LeafNode<String, Vec<(Value, O)>> is !null: Freeze,
PhantomData<Box<(String, Vec<(Value, O)>)>>: Freeze,
*const LeafNode<String, BTreeMap<String, Vec<(Value, O)>>> is !null: Freeze,
PhantomData<Box<(String, BTreeMap<String, Vec<(Value, O)>>)>>: Freeze,
*const LeafNode<Name, BTreeSet<Name>> is !null: Freeze,
PhantomData<Box<(Name, BTreeSet<Name>)>>: Freeze,
impl<O> Move for Cascade<O>
impl<O> RefUnwindSafe for Cascade<O>
impl<O> Send for Cascade<O>where
NodeRef<Owned, String, FeatureValues<O>, LeafOrInternal>: Send,
BoxRaw<(String, FeatureValues<O>)>: Send,
NodeRef<Owned, String, Vec<(Value, O)>, LeafOrInternal>: Send,
BoxRaw<(String, Vec<(Value, O)>)>: Send,
NodeRef<Owned, String, BTreeMap<String, Vec<(Value, O)>>, LeafOrInternal>: Send,
BoxRaw<(String, BTreeMap<String, Vec<(Value, O)>>)>: Send,
NodeRef<Owned, Name, BTreeSet<Name>, LeafOrInternal>: Send,
BoxRaw<(Name, BTreeSet<Name>)>: Send,
impl<O> Sync for Cascade<O>where
NodeRef<Owned, String, FeatureValues<O>, LeafOrInternal>: Sync,
BoxRaw<(String, FeatureValues<O>)>: Sync,
NodeRef<Owned, String, Vec<(Value, O)>, LeafOrInternal>: Sync,
BoxRaw<(String, Vec<(Value, O)>)>: Sync,
NodeRef<Owned, String, BTreeMap<String, Vec<(Value, O)>>, LeafOrInternal>: Sync,
BoxRaw<(String, BTreeMap<String, Vec<(Value, O)>>)>: Sync,
NodeRef<Owned, Name, BTreeSet<Name>, LeafOrInternal>: Sync,
BoxRaw<(Name, BTreeSet<Name>)>: Sync,
impl<O> Unpin for Cascade<O>where
*const LeafNode<String, FeatureValues<O>> is !null: Unpin,
Box<(String, FeatureValues<O>)>: Unpin,
*const LeafNode<String, Vec<(Value, O)>> is !null: Unpin,
Box<(String, Vec<(Value, O)>)>: Unpin,
*const LeafNode<String, BTreeMap<String, Vec<(Value, O)>>> is !null: Unpin,
Box<(String, BTreeMap<String, Vec<(Value, O)>>)>: Unpin,
*const LeafNode<Name, BTreeSet<Name>> is !null: Unpin,
Box<(Name, BTreeSet<Name>)>: Unpin,
impl<O> UnsafeUnpin for Cascade<O>where
*const LeafNode<String, FeatureValues<O>> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, FeatureValues<O>)>>: UnsafeUnpin,
*const LeafNode<String, Vec<(Value, O)>> is !null: UnsafeUnpin,
PhantomData<Box<(String, Vec<(Value, O)>)>>: UnsafeUnpin,
*const LeafNode<String, BTreeMap<String, Vec<(Value, O)>>> is !null: UnsafeUnpin,
PhantomData<Box<(String, BTreeMap<String, Vec<(Value, O)>>)>>: UnsafeUnpin,
*const LeafNode<Name, BTreeSet<Name>> is !null: UnsafeUnpin,
PhantomData<Box<(Name, BTreeSet<Name>)>>: UnsafeUnpin,
impl<O> UnwindSafe for Cascade<O>where
BTreeMap<String, FeatureValues<O>>: UnwindSafe,
BTreeMap<String, Vec<(Value, O)>>: UnwindSafe,
BTreeMap<String, BTreeMap<String, Vec<(Value, O)>>>: UnwindSafe,
BTreeMap<Name, BTreeSet<Name>>: 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
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