Skip to main content

Cascade

Struct Cascade 

Source
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>

Source

pub fn new() -> Cascade<O>

Returns an empty cascade in which no package reaches another, so that every two packages are peers.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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).

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn parsing(&self) -> Result<FlmParsing, Vec<Problem<O>>>

Returns the resulting parsing settings: each key as written by the source of the highest rank that writes it, the others at their defaults.

§Errors

A Problem for each key to which peers give different values, and one when the values cannot be read as the parsing settings’ types.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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§

Source§

impl<O: Clone + CascadeOrigin> Clone for Cascade<O>

Source§

fn clone(&self) -> Self

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<O: Debug + CascadeOrigin> Debug for Cascade<O>

Source§

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

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

impl<O: CascadeOrigin> Default for Cascade<O>

Source§

fn default() -> Cascade<O>

Returns the “default value” for a type. Read more

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>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<Src, Dst> LosslessTryInto<Dst> for Src
where Dst: LosslessTryFrom<Src>,

Source§

fn lossless_try_into(self) -> Option<Dst>

Performs the conversion.
Source§

impl<Src, Dst> LossyInto<Dst> for Src
where Dst: LossyFrom<Src>,

Source§

fn lossy_into(self) -> Dst

Performs the conversion.
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.