pub struct ConfigSetting {
pub key: String,
pub description: String,
pub default: Option<String>,
pub value_type: ConfigValueType,
}Expand description
A single setting a plugin or module declares as configurable.
Fields§
§key: StringDotted key in the workspace config, e.g. skill.dest. The segment
before the first . is the owning namespace (usually the plugin name).
description: StringOne-line description shown by meta config list.
default: Option<String>Default value (as a display string) used when the key is unset.
value_type: ConfigValueTypeDeclared value type, used for validation and display.
Implementations§
Source§impl ConfigSetting
impl ConfigSetting
Sourcepub fn new(
key: impl Into<String>,
description: impl Into<String>,
value_type: ConfigValueType,
) -> ConfigSetting
pub fn new( key: impl Into<String>, description: impl Into<String>, value_type: ConfigValueType, ) -> ConfigSetting
Declare a setting with a dotted key, description, and value type.
Sourcepub fn with_default(self, default: impl Into<String>) -> ConfigSetting
pub fn with_default(self, default: impl Into<String>) -> ConfigSetting
Attach a default value shown when the setting is unset.
Trait Implementations§
Source§impl Clone for ConfigSetting
impl Clone for ConfigSetting
Source§fn clone(&self) -> ConfigSetting
fn clone(&self) -> ConfigSetting
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ConfigSetting
impl Debug for ConfigSetting
Source§impl<'de> Deserialize<'de> for ConfigSetting
impl<'de> Deserialize<'de> for ConfigSetting
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ConfigSetting, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ConfigSetting, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for ConfigSetting
impl Serialize for ConfigSetting
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for ConfigSetting
impl RefUnwindSafe for ConfigSetting
impl Send for ConfigSetting
impl Sync for ConfigSetting
impl Unpin for ConfigSetting
impl UnsafeUnpin for ConfigSetting
impl UnwindSafe for ConfigSetting
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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>
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 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>
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