Skip to main content

SecretValue

Trait SecretValue 

Source
pub trait SecretValue: Sized {
    // Required methods
    fn type_name() -> &'static str;
    fn from_bytes(bytes: Vec<u8>, urn: &str) -> Result<Self, BindError>;
    fn masked_size(&self) -> String;
}
Expand description

Implemented by types that can be stored inside a Secret.

Provides the conversion from raw bytes returned by a source, the type label used in masked values, and a measurement of the value’s size.

Required Methods§

Source

fn type_name() -> &'static str

Short label included in the masked value, e.g. "string", "bytes", "json".

Source

fn from_bytes(bytes: Vec<u8>, urn: &str) -> Result<Self, BindError>

Construct a value from the raw bytes returned by a source.

Source

fn masked_size(&self) -> String

Human-readable size/length included in the masked value, e.g. "12".

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl SecretValue for Value

Source§

fn type_name() -> &'static str

Source§

fn from_bytes(bytes: Vec<u8>, urn: &str) -> Result<Self, BindError>

Source§

fn masked_size(&self) -> String

Source§

impl SecretValue for String

Source§

fn type_name() -> &'static str

Source§

fn from_bytes(bytes: Vec<u8>, urn: &str) -> Result<Self, BindError>

Source§

fn masked_size(&self) -> String

Source§

impl SecretValue for Vec<u8>

Source§

fn type_name() -> &'static str

Source§

fn from_bytes(bytes: Vec<u8>, _urn: &str) -> Result<Self, BindError>

Source§

fn masked_size(&self) -> String

Implementors§