Skip to main content

CppForStat

Struct CppForStat 

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

A for loop. Check is_range_for to tell the two forms apart.

Implementations§

Source§

impl CppForStat

Source

pub fn is_range_for(&self) -> bool

Is this for (decl : range)?

Source

pub fn get_body(&self) -> Option<CppStat>

Source

pub fn has_a_condition(&self) -> bool

Is a condition written in the head — for (int i = 0; i < n; ++i) yes, for (;;) no?

The head is tokens and nodes between two ;, and the second ; ends the condition: anything that is not trivia between the first and the second is the condition — written as a node (i < n) or, in a recovered reading, as a bare token. A for (;;) has nothing there, which is what makes it an endless loop rather than an unknown one.

Trait Implementations§

Source§

impl Clone for CppForStat

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl CppAstNode for CppForStat

Source§

fn syntax(&self) -> &CppSyntaxNode

Source§

fn can_cast(kind: CppSyntaxKind) -> bool

Is a node of this kind a node of type Self? Read more
Source§

fn cast(syntax: CppSyntaxNode) -> Option<Self>

Source§

fn child<N: CppAstNode>(&self) -> Option<N>

The first child node of type N.
Source§

fn token<N: CppAstToken>(&self) -> Option<N>

The first child token of type N.
Source§

fn token_by_kind(&self, kind: CppTokenKind) -> Option<CppGeneralToken>

The first child token with the given kind, as a generic token.
Source§

fn children<N: CppAstNode>(&self) -> CppAstChildren<N> ⓘ

All child nodes of type N.
Source§

fn tokens<N: CppAstToken>(&self) -> CppAstTokenChildren<N> ⓘ

All child tokens of type N.
Source§

fn descendants<N: CppAstNode>(&self) -> impl Iterator<Item = N>

All descendant nodes of type N.
Source§

fn walk_descendants<N: CppAstNode>(&self) -> impl Iterator<Item = WalkEvent<N>>

All descendants of type N, with enter/leave events.
Source§

fn ancestors<N: CppAstNode>(&self) -> impl Iterator<Item = N>

All ancestor nodes of type N, innermost first.
Source§

fn get_root(&self) -> CppSyntaxNode

The root of the tree this node belongs to.
Source§

fn previous_sibling<N: CppAstNode>(&self) -> Option<N>

The sibling node immediately before this one, when it is of type N. Read more
Source§

fn next_sibling<N: CppAstNode>(&self) -> Option<N>

The sibling node immediately after this one, when it is of type N.
Source§

fn get_parent<N: CppAstNode>(&self) -> Option<N>

The parent node, if it is of type N.
Source§

fn get_position(&self) -> TextSize

Source§

fn get_range(&self) -> TextRange

Source§

fn get_self_or_ancestor<N: CppAstNode>(&self) -> Option<N>

The containing node of type N, starting from this node itself.
Source§

fn get_syntax_id(&self) -> CppSyntaxId

A storable, comparable handle to this node. See CppSyntaxId.
Source§

fn dump(&self) -> String

The tree, rendered for debugging.
Source§

impl Debug for CppForStat

Source§

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

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

impl Eq for CppForStat

Source§

impl Hash for CppForStat

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for CppForStat

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for CppForStat

Auto Trait Implementations§

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, dest: *mut u8)

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

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.