full_moon::ast

Struct While

Source
pub struct While { /* private fields */ }
Expand description

A while loop

Implementations§

Source§

impl While

Source

pub fn new(condition: Expression) -> Self

Creates a new While from the given condition

Source

pub fn while_token(&self) -> &TokenReference

The while token

Source

pub fn condition(&self) -> &Expression

The condition part of while condition do

Source

pub fn do_token(&self) -> &TokenReference

The do token

Source

pub fn block(&self) -> &Block

The code inside the while loop

Source

pub fn end_token(&self) -> &TokenReference

The end token

Source

pub fn with_while_token(self, while_token: TokenReference) -> Self

Returns a new While with the given while token

Source

pub fn with_condition(self, condition: Expression) -> Self

Returns a new While with the given condition

Source

pub fn with_do_token(self, do_token: TokenReference) -> Self

Returns a new While with the given do token

Source

pub fn with_block(self, block: Block) -> Self

Returns a new While with the given block

Source

pub fn with_end_token(self, end_token: TokenReference) -> Self

Returns a new While with the given end token

Trait Implementations§

Source§

impl Clone for While

Source§

fn clone(&self) -> While

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for While

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for While

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for While

Source§

fn fmt(&self, __derive_more_f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Node for While

Source§

fn start_position(&self) -> Option<Position>

The start position of a node. None if can’t be determined
Source§

fn end_position(&self) -> Option<Position>

The end position of a node. None if it can’t be determined
Source§

fn similar(&self, other: &Self) -> bool

Whether another node of the same type is the same as this one semantically, ignoring position
Source§

fn tokens<'a>(&'a self) -> Tokens<'a>

The token references that comprise a node
Source§

fn range(&self) -> Option<(Position, Position)>

The full range of a node, if it has both start and end positions
Source§

fn surrounding_trivia(&self) -> (Vec<&Token>, Vec<&Token>)

The tokens surrounding a node that are ignored and not accessible through the node’s own accessors. Use this if you want to get surrounding comments or whitespace. Returns a tuple of the leading and trailing trivia.
Source§

impl PartialEq for While

Source§

fn eq(&self, other: &While) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for While

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for While

Auto Trait Implementations§

§

impl Freeze for While

§

impl RefUnwindSafe for While

§

impl Send for While

§

impl Sync for While

§

impl Unpin for While

§

impl UnwindSafe for While

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToSmolStr for T
where T: Display + ?Sized,

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,