pub struct PackageSettings { /* private fields */ }Expand description
The settings a package is built from: the settings of each of its features that takes some, and the features switched off.
A package is a named bundle of features together with the packages it builds
on, ready to register (PackageEntry); a
PackageFactory builds it from these
settings with
PackageFactory::build. A
host reads each feature’s data with the feature’s SettingsDecl and
inserts the result here. The package’s build function decides what a
feature with no settings here becomes, and leaves every switched-off feature
out (PackageFactory::new);
the standard features are built from their defaults where the settings give none.
Implementations§
Source§impl PackageSettings
impl PackageSettings
Sourcepub fn new() -> PackageSettings
pub fn new() -> PackageSettings
Creates package settings with no feature settings and no feature switched off.
Sourcepub fn insert(&mut self, settings: FeatureSettings) -> &mut PackageSettings
pub fn insert(&mut self, settings: FeatureSettings) -> &mut PackageSettings
Adds one feature’s settings, replacing any settings of the same feature
already added, and returns &mut self for chaining.
Sourcepub fn switch_off(
&mut self,
feature: impl Into<FeatureName>,
) -> &mut PackageSettings
pub fn switch_off( &mut self, feature: impl Into<FeatureName>, ) -> &mut PackageSettings
Switches the feature named feature off, and returns &mut self for
chaining. The package’s build function leaves a switched-off feature out
of the package
(PackageFactory::new).
Sourcepub fn feature(&self, feature: &str) -> Option<&FeatureSettings>
pub fn feature(&self, feature: &str) -> Option<&FeatureSettings>
The settings of the feature named feature, or None when none were
added. A reading through the cascade
(Cascade::read) adds the settings of every
feature in use that declares some and is not switched off, whether or
not anything is written under it.
Sourcepub fn config<C: Any>(&self, feature: &str) -> Option<&C>
pub fn config<C: Any>(&self, feature: &str) -> Option<&C>
The configuration of type C of the feature named feature, or None
when no settings were added for that feature or they hold no
configuration of that type. After a reading through the cascade
(Cascade::read), it is Some for every
feature in use, not switched off, that declares a configuration of type
C: the configuration read from the settings written under the
feature, or from the empty map when nothing is written under it.
Trait Implementations§
Source§impl Clone for PackageSettings
impl Clone for PackageSettings
Source§impl Debug for PackageSettings
impl Debug for PackageSettings
Auto Trait Implementations§
impl !RefUnwindSafe for PackageSettings
impl !UnwindSafe for PackageSettings
impl Forget for PackageSettings
impl Freeze for PackageSettingswhere
*const LeafNode<FeatureName, FeatureSettings> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(FeatureName, FeatureSettings)>>: Freeze,
*const LeafNode<FeatureName, SetValZST> is !null: Freeze,
PhantomData<Box<(FeatureName, SetValZST)>>: Freeze,
impl Move for PackageSettings
impl Send for PackageSettingswhere
NodeRef<Owned, FeatureName, FeatureSettings, LeafOrInternal>: Send,
BoxRaw<(FeatureName, FeatureSettings)>: Send,
NodeRef<Owned, FeatureName, SetValZST, LeafOrInternal>: Send,
BoxRaw<(FeatureName, SetValZST)>: Send,
impl Sync for PackageSettingswhere
NodeRef<Owned, FeatureName, FeatureSettings, LeafOrInternal>: Sync,
BoxRaw<(FeatureName, FeatureSettings)>: Sync,
NodeRef<Owned, FeatureName, SetValZST, LeafOrInternal>: Sync,
BoxRaw<(FeatureName, SetValZST)>: Sync,
impl Unpin for PackageSettingswhere
*const LeafNode<FeatureName, FeatureSettings> is !null: Unpin,
Box<(FeatureName, FeatureSettings)>: Unpin,
*const LeafNode<FeatureName, SetValZST> is !null: Unpin,
Box<(FeatureName, SetValZST)>: Unpin,
impl UnsafeUnpin for PackageSettingswhere
*const LeafNode<FeatureName, FeatureSettings> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(FeatureName, FeatureSettings)>>: UnsafeUnpin,
*const LeafNode<FeatureName, SetValZST> is !null: UnsafeUnpin,
PhantomData<Box<(FeatureName, SetValZST)>>: 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