pub struct SecretValue(/* private fields */);Expand description
A credential value. Debug and Display are redacted, so the spec’s
“never logged” holds by construction rather than by discipline — and it
holds for an object’s members too, which a derived Debug would print.
The stored JSON is the value itself — a string field is a string on disk, an
object field an object — which is what lets the file store’s shape follow the
field’s type with no envelope.
#[serde(transparent)] states that intent, but it is not what enforces
it: serde already serialises a single-field tuple struct as its inner value,
so removing the attribute would change nothing. The guarantee is pinned by
the_stored_json_is_the_value_itself below instead, because a property this
load-bearing should be held by a test rather than by an attribute that turns
out to be decorative.
Eq is deliberately absent — serde_json::Value holds an f64 and is only
PartialEq.
Implementations§
Source§impl SecretValue
impl SecretValue
pub fn new(v: impl Into<Value>) -> Self
Sourcepub fn expose(&self) -> &Value
pub fn expose(&self) -> &Value
The only way to read the value. Named so that call sites are greppable.
Sourcepub fn expose_str(&self) -> Option<&str>
pub fn expose_str(&self) -> Option<&str>
The value as text, for a std:string field. None for any other JSON
type — an object is not a string with extra steps.
Trait Implementations§
Source§impl Clone for SecretValue
impl Clone for SecretValue
Source§fn clone(&self) -> SecretValue
fn clone(&self) -> SecretValue
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more