pub struct IfStatement { /* private fields */ }
Implementations§
Source§impl IfStatement
impl IfStatement
pub fn new(branches: Vec<IfBranch>, else_block: Option<Block>) -> Self
pub fn create(condition: impl Into<Expression>, block: impl Into<Block>) -> Self
pub fn with_tokens(self, tokens: IfStatementTokens) -> Self
pub fn set_tokens(&mut self, tokens: IfStatementTokens)
pub fn get_tokens(&self) -> Option<&IfStatementTokens>
pub fn mutate_tokens(&mut self) -> Option<&mut IfStatementTokens>
pub fn with_branch(self, branch: IfBranch) -> Self
pub fn with_new_branch( self, condition: impl Into<Expression>, block: impl Into<Block>, ) -> Self
pub fn with_else_block<B: Into<Block>>(self, block: B) -> Self
pub fn mutate_all_blocks(&mut self) -> Vec<&mut Block>
pub fn get_branches(&self) -> &Vec<IfBranch>
pub fn iter_branches(&self) -> impl Iterator<Item = &IfBranch>
pub fn branch_count(&self) -> usize
pub fn mutate_branches(&mut self) -> &mut Vec<IfBranch>
pub fn push_new_branch( &mut self, condition: impl Into<Expression>, block: impl Into<Block>, )
pub fn push_branch(&mut self, branch: IfBranch)
pub fn get_else_block(&self) -> Option<&Block>
pub fn mutate_else_block(&mut self) -> &mut Option<Block>
pub fn set_else_block(&mut self, block: impl Into<Block>)
pub fn take_else_block(&mut self) -> Option<Block>
pub fn retain_branches_mut( &mut self, filter: impl FnMut(&mut IfBranch) -> bool, ) -> bool
pub fn clear_comments(&mut self)
pub fn clear_whitespaces(&mut self)
Trait Implementations§
Source§impl Clone for IfStatement
impl Clone for IfStatement
Source§fn clone(&self) -> IfStatement
fn clone(&self) -> IfStatement
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 IfStatement
impl Debug for IfStatement
Source§impl From<IfStatement> for Statement
impl From<IfStatement> for Statement
Source§fn from(if_statement: IfStatement) -> Statement
fn from(if_statement: IfStatement) -> Statement
Converts to this type from the input type.
Source§impl PartialEq for IfStatement
impl PartialEq for IfStatement
impl Eq for IfStatement
impl StructuralPartialEq for IfStatement
Auto Trait Implementations§
impl Freeze for IfStatement
impl RefUnwindSafe for IfStatement
impl Send for IfStatement
impl Sync for IfStatement
impl Unpin for IfStatement
impl UnwindSafe for IfStatement
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<I, T> ExtractContext<I, ()> for T
impl<I, T> ExtractContext<I, ()> for T
Source§fn extract_context(self, _original_input: I)
fn extract_context(self, _original_input: I)
Given the context attached to a nom error, and given the original
input to the nom parser, extract more the useful context information. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<I> RecreateContext<I> for I
impl<I> RecreateContext<I> for I
Source§fn recreate_context(_original_input: I, tail: I) -> I
fn recreate_context(_original_input: I, tail: I) -> I
Given the original input, as well as the context reported by nom,
recreate a context in the original string where the error occurred. Read more