Struct plantuml_parser::IncludeLine
source · pub struct IncludeLine { /* private fields */ }
Expand description
A token sequence that is a line containing a IncludeToken
. (like "\t!include foo.puml \n"
or "\r!include bar.iuml!buz \n"
.)
Examples
use plantuml_parser::{IncludeLine, ParseContainer};
let input = "!include foo.puml \n";
let (rest, (raws, token)) = IncludeLine::parse(input.into())?;
let combined_raw: ParseContainer = raws.into();
assert_eq!(rest, "");
assert_eq!(combined_raw, "!include foo.puml \n");
assert_eq!(token.filepath(), "foo.puml");
assert_eq!(token.index(), None);
assert_eq!(token.id(), None);
let input = "!include_many bar.iuml!1 \n";
let (rest, (raws, token)) = IncludeLine::parse(input.into())?;
let combined_raw: ParseContainer = raws.into();
assert_eq!(rest, "");
assert_eq!(combined_raw, "!include_many bar.iuml!1 \n");
assert_eq!(token.filepath(), "bar.iuml");
assert_eq!(token.index(), Some(1));
assert_eq!(token.id(), Some("1"));
let input = " !include_once baz.txt!qux\n";
let (rest, (raws, token)) = IncludeLine::parse(input.into())?;
let combined_raw: ParseContainer = raws.into();
assert_eq!(rest, "");
assert_eq!(combined_raw, " !include_once baz.txt!qux\n");
assert_eq!(token.filepath(), "baz.txt");
assert_eq!(token.index(), None);
assert_eq!(token.id(), Some("qux"));
Implementations§
source§impl IncludeLine
impl IncludeLine
sourcepub fn parse(input: ParseContainer) -> ParseResult<Self>
pub fn parse(input: ParseContainer) -> ParseResult<Self>
Tries to parse IncludeLine
. (e.g. " !include foo.puml\n"
, "!include bar.iuml!buz \n"
.)
sourcepub fn token(&self) -> &IncludeToken
pub fn token(&self) -> &IncludeToken
Returns the IncludeToken
included.
Methods from Deref<Target = IncludeToken>§
sourcepub fn kind(&self) -> &IncludeKind
pub fn kind(&self) -> &IncludeKind
Returns the IncludeKind
of include keywords.
Methods from Deref<Target = IncludeSpecifierToken>§
Trait Implementations§
source§impl Clone for IncludeLine
impl Clone for IncludeLine
source§fn clone(&self) -> IncludeLine
fn clone(&self) -> IncludeLine
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for IncludeLine
impl Debug for IncludeLine
Auto Trait Implementations§
impl RefUnwindSafe for IncludeLine
impl Send for IncludeLine
impl Sync for IncludeLine
impl Unpin for IncludeLine
impl UnwindSafe for IncludeLine
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more