[][src]Struct tweep::PassageHeader

pub struct PassageHeader {
    pub name: String,
    pub tags: Vec<String>,
    pub metadata: Map<String, Value>,
}

A passage header, along with associated Position, tags, and metadata

Parse Errors

Parse Warnings

Examples

use tweep::{FullContext, PassageHeader};
let input = r#":: A passage [ tag1 tag2 ] { "position": "5,5" }"#;
let context = FullContext::from(None, input.to_string());
let header = PassageHeader::parse(context);

Fields

name: String

The name of the header. This can be a Twine passage name or a special name

tags: Vec<String>

The list of comma separated tags

metadata: Map<String, Value>

A json object containing metadata for the passage

Implementations

impl PassageHeader[src]

pub fn has_tag(&self, tag: &str) -> bool[src]

Returns true if this header is tagged with str

Examples

use tweep::{FullContext, PassageHeader};
let context = FullContext::from(None, ":: A passage [ foo bar ]".to_string());
let out = PassageHeader::parse(context);
assert!(out.get_output().as_ref().ok().unwrap().has_tag("foo"));

pub fn parse(context: FullContext) -> Output<Result<Self, ErrorList>>[src]

Parses a PassageHeader out of the given context

Trait Implementations

impl Debug for PassageHeader[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.