Struct plantuml_parser::ParseContainer
source · pub struct ParseContainer { /* private fields */ }
Expand description
An intermediate representation to parse.
The ParseContainer
has a shared pointer of the original String
and the pair of sub-string position (begin
and end
),
Implementations§
source§impl ParseContainer
impl ParseContainer
sourcepub fn new(raw: Arc<String>) -> Self
pub fn new(raw: Arc<String>) -> Self
Creates a new ParseContainer
from the original string.
The inner positions are held in the entirety of the original string.
Examples
let _ = ParseContainer::new(Arc::new("foo".to_string()));
sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true
if self
has a length of zero
Examples
let container = ParseContainer::from("");
assert!(container.is_empty());
let container = ParseContainer::from("foo");
let (_rest, parsed) = container.split_at(0);
assert!(parsed.is_empty());
let (rest, _parsed) = container.split_at(container.len());
assert!(rest.is_empty());
sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the length of self
Examples
let container = ParseContainer::from("foo");
assert_eq!(container.len(), 3);
sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
Returns a string slice of the sub-string
Examples
let container = ParseContainer::from("foo");
let s: &str = container.as_str(); // Returns `&str`
assert_eq!(s, "foo");
sourcepub fn split_at(&self, mid: usize) -> (Self, Self)
pub fn split_at(&self, mid: usize) -> (Self, Self)
Trait Implementations§
source§impl Borrow<str> for ParseContainer
impl Borrow<str> for ParseContainer
source§impl Clone for ParseContainer
impl Clone for ParseContainer
source§fn clone(&self) -> ParseContainer
fn clone(&self) -> ParseContainer
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 ParseContainer
impl Debug for ParseContainer
source§impl Display for ParseContainer
impl Display for ParseContainer
source§impl From<&[ParseContainer]> for ParseContainer
impl From<&[ParseContainer]> for ParseContainer
source§fn from(x: &[ParseContainer]) -> Self
fn from(x: &[ParseContainer]) -> Self
Converts to this type from the input type.
source§impl From<&str> for ParseContainer
impl From<&str> for ParseContainer
source§impl From<String> for ParseContainer
impl From<String> for ParseContainer
source§impl From<Vec<ParseContainer>> for ParseContainer
impl From<Vec<ParseContainer>> for ParseContainer
source§fn from(x: Vec<ParseContainer>) -> Self
fn from(x: Vec<ParseContainer>) -> Self
Converts to this type from the input type.
source§impl InputLength for ParseContainer
impl InputLength for ParseContainer
source§impl PartialEq<&str> for ParseContainer
impl PartialEq<&str> for ParseContainer
source§impl PartialEq<ParseContainer> for &str
impl PartialEq<ParseContainer> for &str
source§fn eq(&self, rhs: &ParseContainer) -> bool
fn eq(&self, rhs: &ParseContainer) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq for ParseContainer
impl PartialEq for ParseContainer
source§fn eq(&self, rhs: &ParseContainer) -> bool
fn eq(&self, rhs: &ParseContainer) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.Auto Trait Implementations§
impl RefUnwindSafe for ParseContainer
impl Send for ParseContainer
impl Sync for ParseContainer
impl Unpin for ParseContainer
impl UnwindSafe for ParseContainer
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