Struct prs_lib::types::Plaintext[][src]

pub struct Plaintext(_);
Expand description

Plaintext.

Wraps plaintext bytes. This type is limited on purpose, to prevent accidentally leaking the plaintext. Security properties are enforced by secstr::SecVec.

Implementations

New empty plaintext.

Get unsecure reference to inner data.

Warning

Unsecure because we cannot guarantee that the referenced data isn’t cloned. Use with care!

The reference itself is safe to use and share. Data may be cloned from this reference though, when that happens we lose track of it and are unable to securely handle it in memory. You should clone Plaintext instead.

Get the plaintext as UTF8 string.

Warning

Unsecure because we cannot guarantee that the referenced data isn’t cloned. Use with care!

The reference itself is safe to use and share. Data may be cloned from this reference though, when that happens we lose track of it and are unable to securely handle it in memory. You should clone Plaintext instead.

Get the first line of this secret as plaintext.

Returns empty plaintext if there are no lines.

Get all lines execpt the first one.

Returns empty plaintext if there are no lines.

Get line with the given property.

Returns line with the given property. The property prefix is removed, and only the trimmed value is returned. Returns an error if the property does not exist.

This will never return the first line being the password.

Append other plaintext.

Optionally adds platform newline.

Check whether this plaintext is empty.

  • Empty if 0 bytes
  • Empty if bytes parsed as UTF-8 has trimmed length of 0 characters (ignored on encoding failure)

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

The error type produced by a failed conversion.

Convert the given value into an approximately equivalent representation.

The error type produced by a failed conversion.

Convert the subject into an approximately equivalent representation.

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Approximate the subject with the default scheme.

Approximate the subject with a specific scheme.

Approximate the subject to a given type with the default scheme.

Approximate the subject to a given type with a specific scheme.

Convert the subject to a given type.

Attempt to convert the subject to a given type.

Attempt a value conversion of the subject to a given type.

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The error type produced by a failed conversion.

Convert the given value into the subject type.

The type returned in the event of a conversion error.

Performs the conversion.

The error type produced by a failed conversion.

Convert the subject into the destination type.

The type returned in the event of a conversion error.

Performs the conversion.

The error type produced by a failed conversion.

Convert the given value into an exactly equivalent representation.

The error type produced by a failed conversion.

Convert the subject into an exactly equivalent representation.