[][src]Struct mice::FormatOptions

pub struct FormatOptions { /* fields omitted */ }

Formatting options for dice expressions. Necessary for stability of user facing output, which is this library's primary concern.

Default formatting MAY change between patch releases. New public options MUST cause a minor version increment. Changes to the behavior of an existing public option MUST cause a minor version increment.

To get back the old formatting scheme:

let format = MiceFormat::new()
    .total_left()
    .term_commas()
    .term_list_parens()
    .concise();
println!("{}", roll("2d6 + 3")?.format(format));

Methods

impl FormatOptions[src]

pub fn new() -> FormatOptions[src]

Obtain a new FormatOptions object.

pub fn total_right(self) -> Self[src]

The total of an expression will appear on the right hand side of it, = total.

pub fn total_left(self) -> Self[src]

The total of an expression will appear on the left hand side of it, total = .

pub fn no_total(self) -> Self[src]

The total of an expression will not appear. This is the current default.

pub fn concise(self) -> Self[src]

Dice term representations will be (Dice → Total).

pub fn verbose(self) -> Self[src]

Dice term representations will be (Dice → Die1 + Die2 + ...). This is the current default.

pub fn term_commas(self) -> Self[src]

Separate term results with commas. Term1, Term2, ...

pub fn term_pluses(self) -> Self[src]

Separate term results with plus signs. Term1 + Term2 + ... This is the current default.

pub fn dice_parens(self) -> Self[src]

Wrap each dice term result in parentheses. This is the current default.

pub fn no_term_parens(self) -> Self[src]

Don't wrap each dice term result in parentheses.

pub fn term_list_parens(self) -> Self[src]

Wrap entire list of terms in parentheses.

pub fn no_term_list_parens(self) -> Self[src]

Don't wrap entire list of terms in parentheses. This is the current default.

Trait Implementations

impl Default for FormatOptions[src]

impl Clone for FormatOptions[src]

impl Copy for FormatOptions[src]

impl Debug for FormatOptions[src]

Auto Trait Implementations

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]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,