pub struct Pattern { /* private fields */ }Expand description
An immutable, lossless pattern syntax tree backed by a flat arena.
Implementations§
Source§impl Pattern
impl Pattern
Sourcepub fn parse(src: &str) -> Result<Self, ParseError>
pub fn parse(src: &str) -> Result<Self, ParseError>
Parse a pattern into its lossless syntax tree.
§Errors
Returns ParseError when src is malformed or uses an unsupported feature.
pub fn source(&self) -> &str
pub const fn root_id(&self) -> NodeId
pub fn root(&self) -> Cursor<'_>
pub fn node(&self, id: NodeId) -> &Node
pub fn nodes(&self) -> &[Node]
pub fn groups(&self) -> &[GroupInfo]
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn text(&self, span: Span) -> &str
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Pattern
impl RefUnwindSafe for Pattern
impl Send for Pattern
impl Sync for Pattern
impl Unpin for Pattern
impl UnsafeUnpin for Pattern
impl UnwindSafe for Pattern
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