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 kind(&self) -> &PlantUmlLineKind
pub fn kind(&self) -> &PlantUmlLineKind
Returns the PlantUmlLineKind
.
Sourcepub fn block_comment_open(&self) -> Option<&BlockCommentOpenLine>
pub fn block_comment_open(&self) -> Option<&BlockCommentOpenLine>
Returns the BlockCommentOpenLine
if it is BlockCommentOpenLine
.
Sourcepub fn block_comment_close(&self) -> Option<&BlockCommentCloseLine>
pub fn block_comment_close(&self) -> Option<&BlockCommentCloseLine>
Returns the BlockCommentCloseLine
if it is BlockCommentCloseLine
.
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
.
Sourcepub fn into_in_comment(self) -> Self
pub fn into_in_comment(self) -> Self
Convert into PlantUmlLineKind::InComment
.
Trait Implementations§
Source§impl Clone for PlantUmlLine
impl Clone for PlantUmlLine
Source§fn clone(&self) -> PlantUmlLine
fn clone(&self) -> PlantUmlLine
Returns a duplicate 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 Freeze for PlantUmlLine
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