[−][src]Struct tweep::TwineContent
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]
pub fn get_links(&self) -> Vec<TwineLink>
[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]
fn from(p: TwineContent) -> 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
fn parse(input: &'a Self::Input) -> Self::Output
[src]
impl Positional for TwineContent
[src]
fn get_position(&self) -> &Position
[src]
fn mut_position(&mut self) -> &mut Position
[src]
fn get_column(&self) -> Option<usize>
[src]
fn set_column(&mut self, col: usize)
[src]
fn offset_column(&mut self, offset: usize)
[src]
fn get_row(&self) -> Option<usize>
[src]
fn set_row(&mut self, row: usize)
[src]
fn offset_row(&mut self, offset: usize)
[src]
fn get_file(&self) -> Option<&str>
[src]
fn set_file(&mut self, file: String)
[src]
fn with_offset_row(self, offset: usize) -> Self where
Self: Sized,
[src]
Self: Sized,
fn with_offset_column(self, offset: usize) -> Self where
Self: Sized,
[src]
Self: Sized,
fn with_column(self, col: usize) -> Self where
Self: Sized,
[src]
Self: Sized,
fn with_row(self, row: usize) -> Self where
Self: Sized,
[src]
Self: Sized,
fn with_file(self, file: String) -> Self where
Self: Sized,
[src]
Self: Sized,
Auto Trait Implementations
impl RefUnwindSafe for TwineContent
impl Send for TwineContent
impl Sync for TwineContent
impl Unpin for TwineContent
impl UnwindSafe for TwineContent
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,