Struct plantuml_parser::PlantUmlLine
source · pub struct PlantUmlLine { /* private fields */ }
Expand description
A line of PlantUML
Examples
use plantuml_parser::PlantUmlLine;
// StartLine
let input = "@startuml\n";
let (rest, (_, parsed)) = PlantUmlLine::parse(input.into())?;
assert_eq!(rest, "");
assert_eq!(parsed.raw_str(), input);
assert!(parsed.start().is_some());
assert!(parsed.diagram_kind().is_some()); // Returns only `StartLine`
// EndLine
let input = "@enduml\n";
let (rest, (_, parsed)) = PlantUmlLine::parse(input.into())?;
assert_eq!(rest, "");
assert_eq!(parsed.raw_str(), input);
assert!(parsed.end().is_some());
// IncludeLine
let input = "!include foo.puml \n";
let (rest, (_, parsed)) = PlantUmlLine::parse(input.into())?;
assert_eq!(rest, "");
assert_eq!(parsed.raw_str(), input);
assert!(parsed.include().is_some());
// TitleLine
let input = " title EXAMPLE TITLE\n";
let (rest, (_, parsed)) = PlantUmlLine::parse(input.into())?;
assert_eq!(rest, "");
assert_eq!(parsed.raw_str(), input);
assert!(parsed.title().is_some());
// HeaderLine
let input = " header EXAMPLE HEADER\n";
let (rest, (_, parsed)) = PlantUmlLine::parse(input.into())?;
assert_eq!(rest, "");
assert_eq!(parsed.raw_str(), input);
assert!(parsed.header().is_some());
// FooterLine
let input = " footer EXAMPLE FOOTER\n";
let (rest, (_, parsed)) = PlantUmlLine::parse(input.into())?;
assert_eq!(rest, "");
assert_eq!(parsed.raw_str(), input);
assert!(parsed.footer().is_some());
// EmptyLine
let input = " ' comment \n";
let (rest, (_, parsed)) = PlantUmlLine::parse(input.into())?;
assert_eq!(rest, "");
assert_eq!(parsed.raw_str(), input);
assert!(parsed.empty().is_some());
Implementations§
source§impl PlantUmlLine
impl PlantUmlLine
sourcepub fn parse(input: ParseContainer) -> ParseResult<Self>
pub fn parse(input: ParseContainer) -> ParseResult<Self>
Tries to parse PlantUmlLine
.
sourcepub fn include(&self) -> Option<&IncludeLine>
pub fn include(&self) -> Option<&IncludeLine>
Returns the IncludeLine
if it is IncludeLine
.
sourcepub fn header(&self) -> Option<&HeaderLine>
pub fn header(&self) -> Option<&HeaderLine>
Returns the HeaderLine
if it is HeaderLine
.
Returns the FooterLine
if it is FooterLine
.
sourcepub fn diagram_kind(&self) -> Option<&str>
pub fn diagram_kind(&self) -> Option<&str>
Returns the kind of the diagram if it is StartLine
.
Trait Implementations§
source§impl Clone for PlantUmlLine
impl Clone for PlantUmlLine
source§fn clone(&self) -> PlantUmlLine
fn clone(&self) -> PlantUmlLine
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 PlantUmlLine
impl Send for PlantUmlLine
impl Sync for PlantUmlLine
impl Unpin for PlantUmlLine
impl UnwindSafe for PlantUmlLine
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