Struct overflow_error::DivByZero [] [src]

pub struct DivByZero;

Division could not be performed due to division by zero.

Methods

impl DivByZero
[src]

[src]

Adds a payload to this error, representing the left-hand-side of the division.

Examples

use overflow_error::*;

fn checked_div(a: u32, b: u32) -> Result<u32, DivValueByZero<u32>>
{
    if b == 0 {
        Err(DivByZero.val(a))
    } else {
        Ok(a / b)
    }
}

let result = checked_div(1, 0);
assert!(*result.unwrap_err().as_inner() == 1);

[src]

String representing the error.

Examples

use overflow_error::*;
assert!(DivByZero.as_str() == "division by zero");

Trait Implementations

impl Copy for DivByZero
[src]

impl Clone for DivByZero
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for DivByZero
[src]

[src]

Formats the value using the given formatter. Read more

impl PartialEq for DivByZero
[src]

[src]

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

1.0.0
[src]

This method tests for !=.

impl Eq for DivByZero
[src]

impl Hash for DivByZero
[src]

[src]

Feeds this value into the given [Hasher]. Read more

1.3.0
[src]

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

impl Display for DivByZero
[src]

[src]

Formats the value using the given formatter. Read more

impl From<DivByZero> for CannotDiv
[src]

[src]

Performs the conversion.

Auto Trait Implementations

impl Send for DivByZero

impl Sync for DivByZero