pub struct StringParameter {
pub name: ParameterName,
pub domain: StringDomain,
pub constraints: Vec<StringConstraint>,
pub default: Option<String>,
pub labels: Labels,
pub tags: Tags,
}Expand description
A parameter that observes a String.
Fields§
§name: ParameterNameParameter name.
domain: StringDomainValue domain (any string or regex-matched).
constraints: Vec<StringConstraint>Registered constraints.
default: Option<String>Optional default value.
labels: LabelsIntrinsic facts.
Organisational tags.
Implementations§
Source§impl StringParameter
impl StringParameter
Sourcepub fn of(name: ParameterName) -> Self
pub fn of(name: ParameterName) -> Self
Construct a parameter accepting any string.
Sourcepub fn regex(name: ParameterName, pattern: impl Into<String>) -> Result<Self>
pub fn regex(name: ParameterName, pattern: impl Into<String>) -> Result<Self>
Construct a parameter restricted to strings matching pattern.
Sourcepub fn with_default(self, default: impl Into<String>) -> Result<Self>
pub fn with_default(self, default: impl Into<String>) -> Result<Self>
Set the default value. Rejects out-of-domain defaults and defaults that violate registered constraints.
Sourcepub fn with_constraint(self, c: StringConstraint) -> Self
pub fn with_constraint(self, c: StringConstraint) -> Self
Append a constraint.
Sourcepub fn with_label(self, key: LabelKey, value: LabelValue) -> Result<Self>
pub fn with_label(self, key: LabelKey, value: LabelValue) -> Result<Self>
Add a label.
Trait Implementations§
Source§impl Attributed for StringParameter
impl Attributed for StringParameter
Source§impl Clone for StringParameter
impl Clone for StringParameter
Source§fn clone(&self) -> StringParameter
fn clone(&self) -> StringParameter
Returns a duplicate of the value. Read more
1.0.0 · 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 StringParameter
impl Debug for StringParameter
Source§impl<'de> Deserialize<'de> for StringParameter
impl<'de> Deserialize<'de> for StringParameter
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for StringParameter
impl PartialEq for StringParameter
Source§impl Serialize for StringParameter
impl Serialize for StringParameter
impl Eq for StringParameter
impl StructuralPartialEq for StringParameter
Auto Trait Implementations§
impl Freeze for StringParameter
impl RefUnwindSafe for StringParameter
impl Send for StringParameter
impl Sync for StringParameter
impl Unpin for StringParameter
impl UnsafeUnpin for StringParameter
impl UnwindSafe for StringParameter
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.