pub struct BracketState {
pub paren: i32,
pub brace: i32,
pub bracket: i32,
pub inside_quote: Option<char>,
}Expand description
Bracket / quote depth at the cursor, computed by
PartialParse::bracket_state. Lets a grammar-aware provider
answer “am I inside a {...}, (...), [...], or quoted
string?” without re-implementing the scanner.
Fields§
§paren: i32Net ( minus ) count up to the cursor. Negative ⇒ extra
closes (likely user error).
brace: i32Net { minus } count up to the cursor.
bracket: i32Net [ minus ] count up to the cursor.
inside_quote: Option<char>Some(quote) when the cursor sits inside an unclosed
quote of the indicated kind (" or '); None otherwise.
Trait Implementations§
Source§impl Clone for BracketState
impl Clone for BracketState
Source§fn clone(&self) -> BracketState
fn clone(&self) -> BracketState
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for BracketState
Source§impl Debug for BracketState
impl Debug for BracketState
Source§impl Default for BracketState
impl Default for BracketState
Source§fn default() -> BracketState
fn default() -> BracketState
Returns the “default value” for a type. Read more
impl Eq for BracketState
Source§impl PartialEq for BracketState
impl PartialEq for BracketState
Source§fn eq(&self, other: &BracketState) -> bool
fn eq(&self, other: &BracketState) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for BracketState
Auto Trait Implementations§
impl Freeze for BracketState
impl RefUnwindSafe for BracketState
impl Send for BracketState
impl Sync for BracketState
impl Unpin for BracketState
impl UnsafeUnpin for BracketState
impl UnwindSafe for BracketState
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