pub enum Pattern<S: State = Parsed> {
Group(Group<S>),
Set(Set<S>),
Special(Special<S>),
Literal(Literal<S>),
}Expand description
A pattern, or a part of one.
Variants§
Group(Group<S>)
One of several segments, as in (a|b).
Set(Set<S>)
One character out of a set, as in [a-z].
Special(Special<S>)
A word from a wordlist or a Markov chain, or a preset.
Literal(Literal<S>)
Characters that are output as they are.
Implementations§
Source§impl Pattern<Prepared>
impl Pattern<Prepared>
Sourcepub fn generate(&self, rng: &mut dyn RandomStream) -> Result<String, Error>
pub fn generate(&self, rng: &mut dyn RandomStream) -> Result<String, Error>
Generates a passphrase.
Sourcepub fn generate_with_entropy(
&self,
rng: &mut dyn RandomStream,
) -> Result<(String, Entropy), Error>
pub fn generate_with_entropy( &self, rng: &mut dyn RandomStream, ) -> Result<(String, Entropy), Error>
Generates a passphrase, and measures the entropy of the choices that were made for it.
Sourcepub fn generate_into(
&self,
rng: &mut dyn RandomStream,
output: &mut dyn Write,
) -> Result<Entropy, Error>
pub fn generate_into( &self, rng: &mut dyn RandomStream, output: &mut dyn Write, ) -> Result<Entropy, Error>
Generates a passphrase and writes it to the output. Returns the entropy of the choices that were made for it.
Sourcepub fn generate_limited(
&self,
rng: &mut dyn RandomStream,
output: &mut dyn Write,
steps: usize,
) -> Result<Entropy, Error>
pub fn generate_limited( &self, rng: &mut dyn RandomStream, output: &mut dyn Write, steps: usize, ) -> Result<Entropy, Error>
Generates a passphrase and writes it to the output, in no more than a number of steps (see STEP_LIMIT, which is what the other methods use). Returns the entropy of the choices that were made for it.
When it would take more steps, this fails. What was generated up to then has been written to the output.
Trait Implementations§
impl<S: PartialEq + State> StructuralPartialEq for Pattern<S>
Auto Trait Implementations§
impl<S> Forget for Pattern<S>
impl<S> Freeze for Pattern<S>
impl<S> Move for Pattern<S>
impl<S> RefUnwindSafe for Pattern<S>where
Group<S>: RefUnwindSafe,
Set<S>: RefUnwindSafe,
Special<S>: RefUnwindSafe,
Literal<S>: RefUnwindSafe,
impl<S> Send for Pattern<S>
impl<S> Sync for Pattern<S>
impl<S> Unpin for Pattern<S>
impl<S> UnsafeUnpin for Pattern<S>
impl<S> UnwindSafe for Pattern<S>
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