Struct fastly::secret_store::Secret

source ·
pub struct Secret { /* private fields */ }
Expand description

A secret from a secret store.

A secret name has a maximum length of 255 bytes and must contain only letters, numbers, dashes (-), underscores (_), and periods (.).

A secret value has a maximum length of 64 KiB.

Implementations§

Read the plaintext contents of a secret into memory as a byte buffer.

Once a secret is read into memory, a secret’s contents can be repeatedly accessed cheaply.

Examples
let secret = secret_store.get("example").unwrap();
assert_eq!(secret.plaintext(), "hello world!")

Check if a HeaderValue matches the contents of a secret.

let secret = secret_store.get("example").unwrap();
let header = request.get_header("example").unwrap();
if secret.plaintext() == header.as_bytes() {
    println!("you have guessed correctly!");
}

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.