[][src]Struct critfail::CheckOutcome

pub struct CheckOutcome { /* fields omitted */ }

The outcome of a check roll.

This struct is normally constructed as the result of calling roll() on a Check roll expression.

use critfail::{RollExpression, Check, CheckOutcome};

let outcome: CheckOutcome = Check::new("r+1").unwrap().roll();

Implementations

impl CheckOutcome[src]

pub fn score(&self) -> Score[src]

Get the score of a CheckOutcome.

This is the plain numerical score of a roll, without accounting for critial success/failure

use critfail::CheckOutcomeBuilder;

// (20)+4
let critical = CheckOutcomeBuilder::new()
    .check(20)
    .modifier(4)
    .build();

// (16)+4
let normal = CheckOutcomeBuilder::new()
    .check(16)
    .modifier(4)
    .build();
// (1)+4
let fail = CheckOutcomeBuilder::new()
    .check(1)
    .modifier(4)
    .build();

assert_eq!(critical.score(), 24);
assert_eq!(normal.score(), 20);
assert_eq!(fail.score(), 5);

pub fn crit_score(&self) -> CritScore[src]

Get the score of a CheckOutcome that could be a critical success/failure.

use critfail::{CheckOutcomeBuilder, CritScore};

// (20)+4
let critical = CheckOutcomeBuilder::new()
    .check(20)
    .modifier(4)
    .build();

// (16)+4
let normal = CheckOutcomeBuilder::new()
    .check(16)
    .modifier(4)
    .build();
// (1)+4
let fail = CheckOutcomeBuilder::new()
    .check(1)
    .modifier(4)
    .build();

assert_eq!(critical.crit_score(), CritScore::Critical);
assert_eq!(normal.crit_score(), CritScore::Normal(20));
assert_eq!(fail.crit_score(), CritScore::Fail);

Trait Implementations

impl Clone for CheckOutcome[src]

impl Debug for CheckOutcome[src]

impl Display for CheckOutcome[src]

impl From<CheckOutcome> for RollOutcome[src]

impl PartialEq<CheckOutcome> for CheckOutcome[src]

impl StructuralPartialEq for CheckOutcome[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

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

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

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

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[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<V, T> VZip<V> for T where
    V: MultiLane<T>,