pub struct RandStr<'r, const L: usize = 32>(/* private fields */);
👎Deprecated since 0.8.0-rc.1: Use
string_v2
instead, v1 will be removed in 0.9.0.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§
Source§impl<'r> RandStr<'r>
impl<'r> RandStr<'r>
Sourcepub const fn with_charset_default(charset: &'r [u8]) -> Self
👎Deprecated since 0.8.0-rc.1: Use string_v2
instead, v1 will be removed in 0.9.0.
pub const fn with_charset_default(charset: &'r [u8]) -> Self
string_v2
instead, v1 will be removed in 0.9.0.Create a new RandStr
and generate random string with length
setting by L
.
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>)
👎Deprecated since 0.8.0-rc.1: Use
string_v2
instead, v1 will be removed in 0.9.0.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, )
👎Deprecated since 0.8.0-rc.1: Use
string_v2
instead, v1 will be removed in 0.9.0.Push the value to the string with a separator. Read more
Source§fn to_string_ext(self) -> String
fn to_string_ext(self) -> String
👎Deprecated since 0.8.0-rc.1: Use
string_v2
instead, v1 will be removed in 0.9.0.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
👎Deprecated since 0.8.0-rc.1: Use
string_v2
instead, v1 will be removed in 0.9.0.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
👎Deprecated since 0.8.0-rc.1: Use
string_v2
instead, v1 will be removed in 0.9.0.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
👎Deprecated since 0.8.0-rc.1: Use
string_v2
instead, v1 will be removed in 0.9.0.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