[−][src]Enum dia_assert::Level
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
LowNormalMediumHighCriticalMethods
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]
fn eq(&self, other: &Level) -> bool[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool1.0.0[src]
This method tests for !=.
impl Copy for Level[src]
impl Clone for Level[src]
fn clone(&self) -> 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]
Auto Trait Implementations
Blanket Implementations
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> From<T> for T[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,