[][src]Struct tweep::StoryPassages

pub struct StoryPassages {
    pub title: Option<Passage>,
    pub data: Option<Passage>,
    pub passages: HashMap<String, Passage>,
    pub scripts: Vec<Passage>,
    pub stylesheets: Vec<Passage>,
}

A parsed Twee story, that stores the full Passage object of each field

For more information, see the Story struct.

Fields

title: Option<Passage>

StoryTitle passage

data: Option<Passage>

StoryData passage

passages: HashMap<String, Passage>

Map from passage name to Passage for any non-special passages

scripts: Vec<Passage>

List of passages tagged with script

stylesheets: Vec<Passage>

List of passages tagged with stylesheet

Implementations

impl StoryPassages[src]

pub fn from_string(input: String) -> Output<Result<StoryPassages, ErrorList>>[src]

Parses an input String and returns the result or a list of errors, along with a list of any Warnings

pub fn from_path<P: AsRef<Path>>(
    input: P
) -> Output<Result<StoryPassages, ErrorList>>
[src]

Parses a StoryPassages from the given Path. If the given path is a file, parses that file and returns the StoryPassages. If it is a directory, it looks for any files with .tw or .twee extensions and parses them. Returns the parsed output or a list of errors, along with a list of any Warnings

pub fn from_paths<P: AsRef<Path>>(
    input: &[P]
) -> Output<Result<StoryPassages, ErrorList>>
[src]

Parses a StoryPassages from the given Paths. See from_path for additional information on how directories are handled.

pub fn merge_from(&mut self, other: Self) -> Vec<Warning>[src]

Merges the given StoryPassages into this one, producing a possible list of Warnings in the process.

Warnings

Produces a warning if a duplicate StoryTitle or StoryData is found. The duplicate is ignored and the existing one is kept.

pub fn check(&self) -> Vec<Warning>[src]

Performs a set of post-parse checks and returns a list of any warnings

Warnings

pub fn get_start_passage_name(&self) -> Option<&str>[src]

If a start passage is configured in the StoryData, return the name of that passage. If no start passage is configured, check for the presence of a passage called "Start". If that passage exists, return that name, otherwise return None

Trait Implementations

impl Default for StoryPassages[src]

impl From<StoryPassages> for Story[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, 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.