Enum checksums::options::DepthSetting [] [src]

pub enum DepthSetting {
    Infinite,
    LastLevel,
    NRemaining(u32),
}

Representation of how deep recursion should be.

Variants

Infinite

Infinite allowed recursion, -1 in argument

LastLevel

Last recursion level, go no further. 0 in argument. The default

NRemaining

Another N recursion levels remaining.

Entering a value <= 0 here yields unspecified behaviour.

Methods

impl DepthSetting
[src]

fn can_recurse(&self) -> bool

Check if this depth can go one level deeper.

If so, next_level() will return Some, otherwise, None.

Examples

assert!(DepthSetting::Infinite.can_recurse());

assert_false!(DepthSetting::LastLevel.can_recurse());

assert!(DepthSetting::NRemaining(1).can_recurse());
assert!(DepthSetting::NRemaining(100).can_recurse());

fn next_level(&self) -> Option<Self>

Get the next recursion level, if one exists.

The next recursion level does not exist only for LastLevel.

Examples

// Normally you'd acquire from elsewhere.
let depth = DepthSetting::NRemaining(1);

if let Some(next) = depth.next_level() {
    // Recurse into the next level...
    assert_eq!(next, DepthSetting::LastLevel);
}

Trait Implementations

impl FromStr for DepthSetting
[src]

type Err = String

The associated error which can be returned from parsing.

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more

impl From<i32> for DepthSetting
[src]

fn from(n: i32) -> Self

Performs the conversion.

Derived Implementations

impl Eq for DepthSetting
[src]

impl PartialEq for DepthSetting
[src]

fn eq(&self, __arg_0: &DepthSetting) -> bool

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, __arg_0: &DepthSetting) -> bool

This method tests for !=.

impl Hash for DepthSetting
[src]

fn hash<__H: Hasher>(&self, __arg_0: &mut __H)

Feeds this value into the state given, updating the hasher as necessary.

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

Feeds a slice of this type into the state provided.

impl Copy for DepthSetting
[src]

impl Clone for DepthSetting
[src]

fn clone(&self) -> DepthSetting

Returns a copy of the value. Read more

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

Performs copy-assignment from source. Read more

impl Debug for DepthSetting
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.