Struct cyoa::State[][src]

pub struct State {
    pub config: Game,
    // some fields omitted
}
Expand description

The “State” of the game, including config, current path, and history

Fields

config: Game

Implementations

impl State[src]

pub fn jump(&mut self, path: usize)[src]

Sets the game state and history to something else based on user interaction

pub fn get_path(&self) -> &Path[src]

Gets the current path the game is on

pub fn get_path_id(&self) -> usize[src]

Gets the current position (page number)

pub fn export_save(&self) -> String[src]

Exports the save to a string so others can load and replay (WIP)

pub fn import_save(&mut self, save: &String)[src]

Imports a string to the State to load a history

pub fn backtrack(&mut self)[src]

Go back (removes item from history)

pub fn new(data: &String) -> State[src]

Loads the game and returns a new State

Trait Implementations

impl<'de> Deserialize<'de> for State[src]

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
    __D: Deserializer<'de>, 
[src]

Deserialize this value from the given Serde deserializer. Read more

impl Serialize for State[src]

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
    __S: Serializer
[src]

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

impl RefUnwindSafe for State

impl Send for State

impl Sync for State

impl Unpin for State

impl UnwindSafe for State

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]