pub enum ConfigValue {
String(String),
StringArray(Vec<String>),
}Expand description
API-facing configuration value.
Variants§
Implementations§
Source§impl ConfigValue
impl ConfigValue
Sourcepub const REDACTED: &'static str = "***REDACTED***"
pub const REDACTED: &'static str = "***REDACTED***"
Redacted value used when presenting sensitive configuration through APIs or audit logs.
Sourcepub fn from_storage(
value_type: impl Into<ConfigValueType>,
value: String,
) -> Result<Self>
pub fn from_storage( value_type: impl Into<ConfigValueType>, value: String, ) -> Result<Self>
Converts a storage string into an API-facing value for value_type.
Sourcepub fn from_storage_lossy(
value_type: impl Into<ConfigValueType>,
value: String,
on_invalid: impl FnOnce(&ConfigCoreError),
) -> Self
pub fn from_storage_lossy( value_type: impl Into<ConfigValueType>, value: String, on_invalid: impl FnOnce(&ConfigCoreError), ) -> Self
Converts a storage string into an API-facing value and falls back to an empty value on malformed stored data.
Products should still validate writes strictly. This helper is for read/presentation paths where a single bad database row should not break the entire admin config page.
Sourcepub fn empty_for_type(value_type: impl Into<ConfigValueType>) -> Self
pub fn empty_for_type(value_type: impl Into<ConfigValueType>) -> Self
Returns the empty API value appropriate for a declared value type.
Sourcepub fn to_storage_for_type(
&self,
value_type: impl Into<ConfigValueType>,
) -> Result<String>
pub fn to_storage_for_type( &self, value_type: impl Into<ConfigValueType>, ) -> Result<String>
Converts an API-facing value into a storage string for value_type.
Sourcepub fn to_audit_string(&self) -> String
pub fn to_audit_string(&self) -> String
Converts the value into an audit-friendly string.
Trait Implementations§
Source§impl Clone for ConfigValue
impl Clone for ConfigValue
Source§fn clone(&self) -> ConfigValue
fn clone(&self) -> ConfigValue
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 ComposeSchema for ConfigValue
impl ComposeSchema for ConfigValue
Source§impl Debug for ConfigValue
impl Debug for ConfigValue
Source§impl<'de> Deserialize<'de> for ConfigValue
impl<'de> Deserialize<'de> for ConfigValue
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 From<&String> for ConfigValue
impl From<&String> for ConfigValue
Source§impl From<&str> for ConfigValue
impl From<&str> for ConfigValue
Source§impl From<String> for ConfigValue
impl From<String> for ConfigValue
Source§impl PartialEq for ConfigValue
impl PartialEq for ConfigValue
Source§fn eq(&self, other: &ConfigValue) -> bool
fn eq(&self, other: &ConfigValue) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for ConfigValue
impl Serialize for ConfigValue
Source§impl ToSchema for ConfigValue
impl ToSchema for ConfigValue
impl Eq for ConfigValue
impl StructuralPartialEq for ConfigValue
Auto Trait Implementations§
impl Freeze for ConfigValue
impl RefUnwindSafe for ConfigValue
impl Send for ConfigValue
impl Sync for ConfigValue
impl Unpin for ConfigValue
impl UnsafeUnpin for ConfigValue
impl UnwindSafe for ConfigValue
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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