Struct smart_config::metadata::TypeDescription
source · pub struct TypeDescription { /* private fields */ }
Expand description
Human-readable description for a Rust type used in configuration parameter (Boolean value, integer, string etc.).
If a configuration parameter supports complex inputs (objects and/or arrays), this information may contain info on child types (array items; map keys / values).
Implementations§
source§impl TypeDescription
impl TypeDescription
sourcepub fn unit(&self) -> Option<UnitOfMeasurement>
pub fn unit(&self) -> Option<UnitOfMeasurement>
Gets the unit of measurement.
sourcepub fn items(&self) -> Option<(BasicTypes, &Self)>
pub fn items(&self) -> Option<(BasicTypes, &Self)>
Returns the description of array items, if one was provided.
sourcepub fn keys(&self) -> Option<(BasicTypes, &Self)>
pub fn keys(&self) -> Option<(BasicTypes, &Self)>
Returns the description of map keys, if one was provided.
sourcepub fn values(&self) -> Option<(BasicTypes, &Self)>
pub fn values(&self) -> Option<(BasicTypes, &Self)>
Returns the description of map values, if one was provided.
sourcepub fn fallback(&self) -> Option<(BasicTypes, &Self)>
pub fn fallback(&self) -> Option<(BasicTypes, &Self)>
Returns the fallback description, if any.
sourcepub fn contains_secrets(&self) -> bool
pub fn contains_secrets(&self) -> bool
Checks whether this type or any child types (e.g., array items or map keys / values) are marked as secret.
sourcepub fn set_details(
&mut self,
details: impl Into<Cow<'static, str>>,
) -> &mut Self
pub fn set_details( &mut self, details: impl Into<Cow<'static, str>>, ) -> &mut Self
Sets human-readable type details.
sourcepub fn set_unit(&mut self, unit: UnitOfMeasurement) -> &mut Self
pub fn set_unit(&mut self, unit: UnitOfMeasurement) -> &mut Self
Adds a unit of measurement.
sourcepub fn set_validations<T>(
&mut self,
validations: &[&'static dyn Validate<T>],
) -> &mut Self
pub fn set_validations<T>( &mut self, validations: &[&'static dyn Validate<T>], ) -> &mut Self
Sets validation for the type.
sourcepub fn set_deserialize_if<T>(
&mut self,
condition: &'static dyn Validate<T>,
) -> &mut Self
pub fn set_deserialize_if<T>( &mut self, condition: &'static dyn Validate<T>, ) -> &mut Self
Sets a “deserialize if” condition for the type.
sourcepub fn set_secret(&mut self) -> &mut Self
pub fn set_secret(&mut self) -> &mut Self
Marks the value as secret.
sourcepub fn set_items<T: 'static>(
&mut self,
items: &impl DeserializeParam<T>,
) -> &mut Self
pub fn set_items<T: 'static>( &mut self, items: &impl DeserializeParam<T>, ) -> &mut Self
Adds a description of array items. This only makes sense for params accepting array input.
sourcepub fn set_entries<K: 'static, V: 'static>(
&mut self,
keys: &impl DeserializeParam<K>,
values: &impl DeserializeParam<V>,
) -> &mut Self
pub fn set_entries<K: 'static, V: 'static>( &mut self, keys: &impl DeserializeParam<K>, values: &impl DeserializeParam<V>, ) -> &mut Self
Adds a description of keys and values. This only makes sense for params accepting object input.
sourcepub fn set_fallback<T: 'static>(&mut self, fallback: &impl DeserializeParam<T>)
pub fn set_fallback<T: 'static>(&mut self, fallback: &impl DeserializeParam<T>)
Adds a fallback deserializer description.
Trait Implementations§
source§impl Clone for TypeDescription
impl Clone for TypeDescription
source§fn clone(&self) -> TypeDescription
fn clone(&self) -> TypeDescription
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for TypeDescription
impl Debug for TypeDescription
source§impl Default for TypeDescription
impl Default for TypeDescription
source§fn default() -> TypeDescription
fn default() -> TypeDescription
Auto Trait Implementations§
impl Freeze for TypeDescription
impl RefUnwindSafe for TypeDescription
impl Send for TypeDescription
impl Sync for TypeDescription
impl Unpin for TypeDescription
impl UnwindSafe for TypeDescription
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)