pub struct LogSafeText<'a>(/* private fields */);Expand description
Redacted text whose log-structure and bidirectional controls are escaped.
Values can only be constructed inside this crate after escaping, preventing arbitrary untrusted text from being labeled log-safe.
§Type Parameters
'a- Lifetime of any borrowed escaped text stored by the value.
Implementations§
Source§impl<'a> LogSafeText<'a>
impl<'a> LogSafeText<'a>
Sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
Borrows the escaped log-safe contents.
§Returns
The escaped text without allocating or formatting it.
Sourcepub fn into_owned(self) -> String
pub fn into_owned(self) -> String
Converts this value into an owned escaped string.
§Returns
The existing string allocation when this value already owns its contents, or a copied string for borrowed contents.
Sourcepub const fn with_output_limit(
&self,
limit: LogOutputLimit,
) -> BoundedLogSafeDisplay<'_>
pub const fn with_output_limit( &self, limit: LogOutputLimit, ) -> BoundedLogSafeDisplay<'_>
Trait Implementations§
Source§impl AsRef<str> for LogSafeText<'_>
impl AsRef<str> for LogSafeText<'_>
Source§impl<'a> Clone for LogSafeText<'a>
impl<'a> Clone for LogSafeText<'a>
Source§fn clone(&self) -> LogSafeText<'a>
fn clone(&self) -> LogSafeText<'a>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'a> Debug for LogSafeText<'a>
impl<'a> Debug for LogSafeText<'a>
Source§impl Display for LogSafeText<'_>
impl Display for LogSafeText<'_>
Source§fn fmt(&self, formatter: &mut Formatter<'_>) -> Result
fn fmt(&self, formatter: &mut Formatter<'_>) -> Result
Writes the already escaped contents without surrounding quotes.
§Parameters
formatter- Destination formatting context.
§Returns
The formatter result from writing the complete escaped string.
§Errors
Returns fmt::Error when the destination formatter cannot accept the
complete escaped string.
impl<'a> Eq for LogSafeText<'a>
Source§impl<'a> PartialEq for LogSafeText<'a>
impl<'a> PartialEq for LogSafeText<'a>
impl<'a> StructuralPartialEq for LogSafeText<'a>
Auto Trait Implementations§
impl<'a> Freeze for LogSafeText<'a>
impl<'a> RefUnwindSafe for LogSafeText<'a>
impl<'a> Send for LogSafeText<'a>
impl<'a> Sync for LogSafeText<'a>
impl<'a> Unpin for LogSafeText<'a>
impl<'a> UnsafeUnpin for LogSafeText<'a>
impl<'a> UnwindSafe for LogSafeText<'a>
Blanket Implementations§
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
Mutably borrows from an owned value. Read more