Struct prs_lib::types::Plaintext [−][src]
pub struct Plaintext(_);
Plaintext.
Wraps plaintext bytes. This type is limited on purpose, to prevent accidentally leaking the
plaintext. Security properties are enforced by secstr::SecVec.
Implementations
impl Plaintext[src]
pub fn empty() -> Self[src]
New empty plaintext.
pub fn unsecure_ref(&self) -> &[u8][src]
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.
pub fn unsecure_to_str(&self) -> Result<&str, Utf8Error>[src]
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.
pub fn first_line(self) -> Result<Plaintext>[src]
Get the first line of this secret as plaintext.
Returns empty plaintext if there are no lines.
pub fn except_first_line(self) -> Result<Plaintext>[src]
Get all lines execpt the first one.
Returns empty plaintext if there are no lines.
pub fn property(self, property: &str) -> Result<Plaintext>[src]
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.
pub fn append(&mut self, other: Plaintext, newline: bool)[src]
Append other plaintext.
Optionally adds platform newline.
pub fn is_empty(&self) -> bool[src]
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
impl Clone for Plaintext[src]
impl Eq for Plaintext[src]
impl From<&'_ str> for Plaintext[src]
impl From<String> for Plaintext[src]
impl From<Vec<u8, Global>> for Plaintext[src]
impl PartialEq<Plaintext> for Plaintext[src]
impl StructuralEq for Plaintext[src]
impl StructuralPartialEq for Plaintext[src]
Auto Trait Implementations
impl RefUnwindSafe for Plaintext
impl Send for Plaintext
impl Sync for Plaintext
impl Unpin for Plaintext
impl UnwindSafe for Plaintext
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<Src, Scheme> ApproxFrom<Src, Scheme> for Src where
Scheme: ApproxScheme,
Scheme: ApproxScheme,
type Err = NoError
The error type produced by a failed conversion.
pub fn approx_from(
src: Src
) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
src: Src
) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Src where
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
The error type produced by a failed conversion.
pub fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T, Dst> ConvAsUtil<Dst> for T
pub fn approx(self) -> Result<Dst, Self::Err> where
Self: ApproxInto<Dst, DefaultApprox>,
Self: ApproxInto<Dst, DefaultApprox>,
pub fn approx_by<Scheme>(self) -> Result<Dst, Self::Err> where
Self: ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
Self: ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
impl<T> ConvUtil for T
pub fn approx_as<Dst>(self) -> Result<Dst, Self::Err> where
Self: ApproxInto<Dst, DefaultApprox>,
Self: ApproxInto<Dst, DefaultApprox>,
pub fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err> where
Self: ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
Self: ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
pub fn into_as<Dst>(self) -> Dst where
Self: Into<Dst>,
Self: Into<Dst>,
pub fn try_as<Dst>(self) -> Result<Dst, Self::Err> where
Self: TryInto<Dst>,
Self: TryInto<Dst>,
pub fn value_as<Dst>(self) -> Result<Dst, Self::Err> where
Self: ValueInto<Dst>,
Self: ValueInto<Dst>,
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
impl<Src> TryFrom<Src> for Src
type Err = NoError
The error type produced by a failed conversion.
pub fn try_from(src: Src) -> Result<Src, <Src as TryFrom<Src>>::Err>
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<Src, Dst> TryInto<Dst> for Src where
Dst: TryFrom<Src>,
Dst: TryFrom<Src>,
type Err = <Dst as TryFrom<Src>>::Err
The error type produced by a failed conversion.
pub fn try_into(self) -> Result<Dst, <Src as TryInto<Dst>>::Err>
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<Src> ValueFrom<Src> for Src
type Err = NoError
The error type produced by a failed conversion.
pub fn value_from(src: Src) -> Result<Src, <Src as ValueFrom<Src>>::Err>
impl<Src, Dst> ValueInto<Dst> for Src where
Dst: ValueFrom<Src>,
Dst: ValueFrom<Src>,
type Err = <Dst as ValueFrom<Src>>::Err
The error type produced by a failed conversion.