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

source

pub fn details(&self) -> Option<&str>

Gets the type details.

source

pub fn unit(&self) -> Option<UnitOfMeasurement>

Gets the unit of measurement.

source

pub fn items(&self) -> Option<(BasicTypes, &Self)>

Returns the description of array items, if one was provided.

source

pub fn keys(&self) -> Option<(BasicTypes, &Self)>

Returns the description of map keys, if one was provided.

source

pub fn values(&self) -> Option<(BasicTypes, &Self)>

Returns the description of map values, if one was provided.

source

pub fn fallback(&self) -> Option<(BasicTypes, &Self)>

Returns the fallback description, if any.

source

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.

source

pub fn set_details( &mut self, details: impl Into<Cow<'static, str>>, ) -> &mut Self

Sets human-readable type details.

source

pub fn set_unit(&mut self, unit: UnitOfMeasurement) -> &mut Self

Adds a unit of measurement.

source

pub fn set_validations<T>( &mut self, validations: &[&'static dyn Validate<T>], ) -> &mut Self

Sets validation for the type.

source

pub fn set_deserialize_if<T>( &mut self, condition: &'static dyn Validate<T>, ) -> &mut Self

Sets a “deserialize if” condition for the type.

source

pub fn set_secret(&mut self) -> &mut Self

Marks the value as secret.

source

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.

source

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.

source

pub fn set_fallback<T: 'static>(&mut self, fallback: &impl DeserializeParam<T>)

Adds a fallback deserializer description.

Trait Implementations§

source§

impl Clone for TypeDescription

source§

fn clone(&self) -> TypeDescription

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for TypeDescription

source§

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

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

impl Default for TypeDescription

source§

fn default() -> TypeDescription

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

impl Display for TypeDescription

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToOwned for T
where T: Clone,

§

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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more