[][src]Struct tweep::TwineContent

pub struct TwineContent {
    pub content: String,
    pub position: Position,
    // some fields omitted
}

The contents of a Twine passage.

Contains the content of the passage along with the Position. The get_links method can be used to retrieve all Twine links that were parsed out of the passage.

Parse Errors

None

Parse Warnings

  • UnclosedLink - An unclosed Twine link such as `[[Passage Name``
  • WhitespaceInLink - Errant whitespace in link such as [[Display Text-> Passage Name]]

Notes

Currently, the supported formats for links are the following:

[[Passge Name]]
[[Display Text|Passage Name]]
[[Display Text->Passage Name]]
[[Passage Name<-Display Text]]

Examples

use tweep::{Parser, Position, TwineContent, TwineLink};
let input:Vec<&str> = r#"This is a Twine content passage. It has a [[link]]
And some [[other link->Another passage]]
"#.split('\n').collect();
let out = TwineContent::parse(&input);
assert_eq!(out.get_output().as_ref().ok().unwrap().get_links(), vec![
   TwineLink { target: "link".to_string(), position: Position::RowColumn(0, 44) },
   TwineLink { target: "Another passage".to_string(), position: Position::RowColumn(1, 11) }]);

Fields

content: String

The content of the passage

position: Position

The position of the passage

Methods

impl TwineContent[src]

Gets a Vec of all the links contained within this content

Trait Implementations

impl Debug for TwineContent[src]

impl From<TwineContent> for PassageContent[src]

impl<'a> Parser<'a> for TwineContent[src]

type Output = Output<Result<Self, ErrorList>>

The type produced by this parser

type Input = [&'a str]

The type accepted by this parser

impl Positional for TwineContent[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.