pub struct Plaintext(/* private fields */);
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§
Source§impl Plaintext
impl Plaintext
Sourcepub fn unsecure_ref(&self) -> &[u8] ⓘ
pub fn unsecure_ref(&self) -> &[u8] ⓘ
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.
Sourcepub fn unsecure_to_str(&self) -> Result<&str, Utf8Error>
pub fn unsecure_to_str(&self) -> Result<&str, Utf8Error>
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.
Sourcepub fn first_line(&self) -> Result<Plaintext>
pub fn first_line(&self) -> Result<Plaintext>
Get the first line of this secret as plaintext.
Returns empty plaintext if there are no lines.
Sourcepub fn except_first_line(&self) -> Result<Plaintext>
pub fn except_first_line(&self) -> Result<Plaintext>
Get all lines execpt the first one.
Returns empty plaintext if there are no lines.
Sourcepub fn property(&self, property: &str) -> Result<Plaintext>
pub fn property(&self, property: &str) -> Result<Plaintext>
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.
Trait Implementations§
impl Eq for Plaintext
impl StructuralPartialEq for Plaintext
Auto Trait Implementations§
impl Freeze for Plaintext
impl RefUnwindSafe for Plaintext
impl Send for Plaintext
impl Sync for Plaintext
impl Unpin for Plaintext
impl UnwindSafe for Plaintext
Blanket Implementations§
Source§impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
Source§fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
Source§impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
Source§type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
Source§fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, Dst> ConvAsUtil<Dst> for T
impl<T, Dst> ConvAsUtil<Dst> for T
Source§impl<T> ConvUtil for T
impl<T> ConvUtil for T
Source§fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst>,
fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst>,
Source§fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>
fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoSql for T
impl<T> IntoSql for T
Source§fn into_sql<T>(self) -> Self::Expression
fn into_sql<T>(self) -> Self::Expression
self
to an expression for Diesel’s query builder. Read moreSource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
&self
to an expression for Diesel’s query builder. Read more