pub struct RandStr<'r, const L: usize = 32>(/* private fields */);
Expand description
Randon string, with fix length and given charset.
§Generic Parameters
L
: The length of the string. Default is 32.
Notice: must make sure each u8 within the slice is valid single byte UTF-8 char.
If the charset is 0123456789abcdef
, RandHexStr
is recommended and 4~6x
faster than this (when feature feat-random-fast
enabled).
Implementations§
Trait Implementations§
Source§impl<const L: usize> StringExtT for RandStr<'_, L>
impl<const L: usize> StringExtT for RandStr<'_, L>
Source§fn push_to_string(self, string: &mut Vec<u8>)
fn push_to_string(self, string: &mut Vec<u8>)
Push the value to the string.
Source§fn push_to_string_with_separator(
self,
string: &mut Vec<u8>,
separator: impl SeparatorT,
)
fn push_to_string_with_separator( self, string: &mut Vec<u8>, separator: impl SeparatorT, )
Push the value to the string with a separator. Read more
Source§fn to_string_ext(self) -> String
fn to_string_ext(self) -> String
Encode the value to the string.
Source§fn to_string_ext_with_sep(self, separator: impl SeparatorT) -> String
fn to_string_ext_with_sep(self, separator: impl SeparatorT) -> String
Push the value to the string with separator Read more
Source§fn with_prefix<P: StringExtT>(self, prefix: P) -> impl StringExtT
fn with_prefix<P: StringExtT>(self, prefix: P) -> impl StringExtT
With prefix. Read more
Source§fn with_suffix<S: StringExtT>(self, suffix: S) -> impl StringExtT
fn with_suffix<S: StringExtT>(self, suffix: S) -> impl StringExtT
With suffix. Read more
impl<'r, const L: usize> Copy for RandStr<'r, L>
Auto Trait Implementations§
impl<'r, const L: usize> Freeze for RandStr<'r, L>
impl<'r, const L: usize> RefUnwindSafe for RandStr<'r, L>
impl<'r, const L: usize> Send for RandStr<'r, L>
impl<'r, const L: usize> Sync for RandStr<'r, L>
impl<'r, const L: usize> Unpin for RandStr<'r, L>
impl<'r, const L: usize> UnwindSafe for RandStr<'r, L>
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