pub struct Form {
pub kind: FormKind,
pub span: Span,
}Expand description
A parsed Clojure form with its source location.
PartialEq ignores spans so test assertions can compare forms without
constructing exact span values.
Fields§
§kind: FormKind§span: SpanImplementations§
Source§impl Form
impl Form
pub fn new(kind: FormKind, span: Span) -> Self
Sourcepub fn heap_size(&self) -> usize
pub fn heap_size(&self) -> usize
Total heap bytes owned by this form tree (excluding the Form itself).
Sourcepub fn unmeta(&self) -> &Form
pub fn unmeta(&self) -> &Form
The annotated form with every ^meta wrapper removed.
Returns self when the form carries no metadata. Stacked metadata
(^:a ^:b x) is peeled down to the innermost form.
Sourcepub fn peel_meta(&self) -> (Vec<&Form>, &Form)
pub fn peel_meta(&self) -> (Vec<&Form>, &Form)
The ^meta forms attached to this form, outermost first, together with
the annotated form itself.
Sourcepub fn as_keyword(&self) -> Option<&str>
pub fn as_keyword(&self) -> Option<&str>
The keyword name (without the leading :), if this form is a keyword.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Form
impl RefUnwindSafe for Form
impl Send for Form
impl Sync for Form
impl Unpin for Form
impl UnsafeUnpin for Form
impl UnwindSafe for Form
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