Struct dia_assert::Assert [] [src]

pub struct Assert { /* fields omitted */ }

Use this struct with Level to assert a user action.

Methods

impl Assert
[src]

[src]

Makes new instance.

[src]

Tries an assert with your own string.

Sometimes you need to print your own messages and/or your verification string, instead of the pre-defined ones provided by this crate. This function can help you with that.

  • Inside closure f, you can print your messages.
  • Then f returns the string to be verified. You can make use of Level.rand_s() if you want to.

The function will read user input from stdin and verify it. Note that case is ignored.

[src]

Tries n times.

This function calls try_with().

  • If the user passed, it returns peacefully.
  • For other cases (the user fails, or stdout failure...), it calls process::exit() with the exit code you provided in ::new().

[src]

Tries once.

This function calls try_n_with() with 1 passed as n.

[src]

Tries an assert.

The function generates a string with difficulty based on level. Then asks the user to type that string.

[src]

Tries n times.

This function calls try().

  • If the user passed, it returns peacefully.
  • For other cases (the user fails, or stdout failure...), it calls process::exit() with the exit code you provided in ::new().

[src]

Tries once.

This function calls try_n() with 1 passed as n.

Trait Implementations

Auto Trait Implementations

impl Send for Assert

impl Sync for Assert