Enum crowbook::BookOption [] [src]

pub enum BookOption {
    String(String),
    Bool(bool),
    Char(char),
    Int(i32),
    Float(f32),
    Path(String),
    StringVec(Vec<String>),
    // some variants omitted
}

Structure for storing a book option

This Enum might grow additional variants, so library users should not count on exhaustive matching.

Variants

Stores a String

Stores a boolean

Stores a single char

Stores an int

Stores a float

Stores a path

Stored the same way as a string, but some base path is usually prepended to it

Stores a list of strings

Methods

impl BookOption
[src]

Returns the BookOption as a &str, or an error if it isn't a String variant

Examples

use crowbook::BookOption;

let option = BookOption::String("foo".to_owned());
assert_eq!(option.as_str(), Ok("foo"));

let option = BookOption::Int(42);
assert!(option.as_str().is_err());

Returns the BookOption as a slice on a vector of strings

Returns the BookOption as a &str, on an error if it isn't a Path variant.

Retuns the BookOption as a bool, or an error if it isn't a Bool variant.

Returns the BookOption as a char, or an error if it isn't a Char variant.

Retuns the BookOption as an i32, or an error if it isn't an Int variant.

Returns the BookOption as an f32, or an error if it isn't a Float variant.

Trait Implementations

impl Debug for BookOption
[src]

Formats the value using the given formatter.

impl PartialEq for BookOption
[src]

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

This method tests for !=.

impl Clone for BookOption
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more