SecretsFile

Struct SecretsFile 

Source
pub struct SecretsFile { /* private fields */ }

Implementations§

Source§

impl SecretsFile

Source

pub fn load<P: AsRef<Path>>(path: P) -> Result<Self>

Creates a new SecretsFile by reading the specified file.

Source

pub fn public_key(&self) -> Option<Key>

Extracts the public key from the JSON object.

Source

pub fn transform<F: Fn(String) -> Result<String>>( &mut self, transformer: F, ) -> Result<()>

Performs the supplied transformation function on each eligible value in the document. Eligible in this case refers to string values who’s key does not start with an underscore.

The transformer will be called for each eligible string value and is expected to return a new value to be used in it’s place.

This function transforms the values in place by mutating the underlying structure.

Source

pub fn children(&self, root_key: &str) -> Option<HashMap<&str, &str>>

Returns a map of all direct children of the supplied key with scalar values.

Source

pub fn without_public_key(&self) -> Self

Returns a new SecretsFile that is a clone of this one without the _public_key field.

Trait Implementations§

Source§

impl Debug for SecretsFile

Source§

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

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

impl Display for SecretsFile

Source§

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

Returns the pretty-printed JSON representation.

Source§

impl FromStr for SecretsFile

Source§

type Err = Error

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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

Source§

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>,

Source§

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>,

Source§

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

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

Source§

fn vzip(self) -> V