Struct plantuml_parser::IncludeSpecifierToken
source · pub struct IncludeSpecifierToken { /* private fields */ }
Expand description
A token sequence that is the include specifier (DiagramIdToken
) around the include keyword. (like "foo.puml"
or "bar.iuml!buz"
.)
[relative filepath]
[relative filepath]![index]
[relative filepath]![id]
Examples
use plantuml_parser::{IncludeSpecifierToken, ParseContainer};
let input = "filepath_0 rest";
let (rest, (raws, token)) = IncludeSpecifierToken::parse(input.into())?;
let combined_raw: ParseContainer = raws.into();
assert_eq!(rest, " rest");
assert_eq!(combined_raw, "filepath_0");
assert_eq!(token.filepath(), "filepath_0");
assert_eq!(token.index(), None);
assert_eq!(token.id(), None);
let input = "file_path_1!diagram_2 rest";
let (rest, (raws, token)) = IncludeSpecifierToken::parse(input.into())?;
let combined_raw: ParseContainer = raws.into();
assert_eq!(rest, " rest");
assert_eq!(combined_raw, "file_path_1!diagram_2");
assert_eq!(token.filepath(), "file_path_1");
assert_eq!(token.index(), None);
assert_eq!(token.id(), Some("diagram_2"));
let input = "file_path_2!4 rest";
let (rest, (raws, token)) = IncludeSpecifierToken::parse(input.into())?;
let combined_raw: ParseContainer = raws.into();
assert_eq!(rest, " rest");
assert_eq!(combined_raw, "file_path_2!4");
assert_eq!(token.filepath(), "file_path_2");
assert_eq!(token.index(), Some(4));
assert_eq!(token.id(), Some("4"));
Implementations§
source§impl IncludeSpecifierToken
impl IncludeSpecifierToken
sourcepub fn parse(input: ParseContainer) -> ParseResult<Self>
pub fn parse(input: ParseContainer) -> ParseResult<Self>
Tries to parse IncludeSpecifierToken
. (e.g. "foo.puml"
, "bar.iuml!buz"
.)
Trait Implementations§
source§impl Clone for IncludeSpecifierToken
impl Clone for IncludeSpecifierToken
source§fn clone(&self) -> IncludeSpecifierToken
fn clone(&self) -> IncludeSpecifierToken
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 moreAuto Trait Implementations§
impl RefUnwindSafe for IncludeSpecifierToken
impl Send for IncludeSpecifierToken
impl Sync for IncludeSpecifierToken
impl Unpin for IncludeSpecifierToken
impl UnwindSafe for IncludeSpecifierToken
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