[][src]Enum dia_assert::Level

pub enum Level {
    Low,
    Normal,
    Medium,
    High,
    Critical,
}

Level

For important tasks, if you want to confirm the user, you can use hash() to generate a random string, and ask them to type it.

Variants

LowNormalMediumHighCritical

Methods

impl Level[src]

pub fn hash(&self) -> String[src]

Generates a random hash string based on current level

Notes

  • On non-Unix systems, this function will generate a random string based on current time.

  • On Unix systems, it will try to read some bytes from /dev/urandom. If any error raises, it reverts back to above method. Also:

    • For security reason, if it detects some abnormal attributes from that file, it will print warnings to stderr, and will not read any bytes.

    • If reading succeeds, as a nice gesture, it will write some bytes back to that file.

  • Higher levels always generate longer strings.

They might look like these:

Level Sample
Low e9
Normal ac8c
Medium db9c-725a
High dca9-e93c-f8b2
Critical 115a-a983-4c11-4a38

Trait Implementations

impl Eq for Level[src]

impl PartialEq<Level> for Level[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl Copy for Level[src]

impl Clone for Level[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Level[src]

impl Hash for Level[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given [Hasher]. Read more

Auto Trait Implementations

impl Send for Level

impl Sync for Level

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]