pub struct BracketSyntax {
pub openers: &'static [u8],
pub closers: &'static [u8],
}Expand description
Per-language bracket sets for the opener/closer scan.
Empty sets are meaningful, not a null case: they are how a language
with no bracket-block notion opts out of the scan and gets pure
keep behaviour from the same code path.
Fields§
§openers: &'static [u8]§closers: &'static [u8]Implementations§
Source§impl BracketSyntax
impl BracketSyntax
Sourcepub const BRACES: Self
pub const BRACES: Self
{, (, [ – the C-family set, correct for every bundled
language whose blocks are brace-delimited.
Sourcepub fn for_lang(lang: Lang) -> Self
pub fn for_lang(lang: Lang) -> Self
The bracket sets for a language.
Prose languages get Self::NONE so a stray brace in a
sentence does not indent the next line. Everything else gets
Self::BRACES – including the indent-sensitive languages
(Python, YAML), where brackets still bound continuation lines
even though blocks are not brace-delimited, which is exactly
the case the scan gets right.
Sourcepub fn starts_with_closer(&self, line: &str) -> bool
pub fn starts_with_closer(&self, line: &str) -> bool
Whether line’s first non-whitespace byte is a closer.
Public because the tree path needs it too: at query time the closer about to move down with the cursor is still on the line above, so the tree cannot see it and the caller applies the dedent itself.
Trait Implementations§
Source§impl Clone for BracketSyntax
impl Clone for BracketSyntax
Source§fn clone(&self) -> BracketSyntax
fn clone(&self) -> BracketSyntax
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for BracketSyntax
Source§impl Debug for BracketSyntax
impl Debug for BracketSyntax
Source§impl Default for BracketSyntax
impl Default for BracketSyntax
Source§fn default() -> BracketSyntax
fn default() -> BracketSyntax
impl Eq for BracketSyntax
Source§impl PartialEq for BracketSyntax
impl PartialEq for BracketSyntax
impl StructuralPartialEq for BracketSyntax
Auto Trait Implementations§
impl Freeze for BracketSyntax
impl RefUnwindSafe for BracketSyntax
impl Send for BracketSyntax
impl Sync for BracketSyntax
impl Unpin for BracketSyntax
impl UnsafeUnpin for BracketSyntax
impl UnwindSafe for BracketSyntax
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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> ⓘ
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> ⓘ
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