Struct sqruff_lib::core::rules::context::RuleContext
source · pub struct RuleContext<'a> {
pub dialect: &'a Dialect,
pub fix: bool,
pub templated_file: Option<TemplatedFile>,
pub path: Option<String>,
pub config: Option<&'a FluffConfig>,
pub segment: ErasedSegment,
pub parent_stack: Vec<ErasedSegment>,
pub raw_stack: Vec<ErasedSegment>,
pub memory: Rc<RefCell<AnyMap>>,
pub segment_idx: usize,
}
Expand description
Struct for holding the context passed to rule eval function
Fields§
§dialect: &'a Dialect
§fix: bool
§templated_file: Option<TemplatedFile>
§path: Option<String>
§config: Option<&'a FluffConfig>
§segment: ErasedSegment
segment: The segment in question
parent_stack: Vec<ErasedSegment>
parent_stack: A tuple of the path from the root to this segment.
raw_stack: Vec<ErasedSegment>
raw_stack: All of the raw segments so far in the file
memory: Rc<RefCell<AnyMap>>
memory: Arbitrary storage for the rule
segment_idx: usize
segment_idx: The index of this segment in the parent
Implementations§
source§impl RuleContext<'_>
impl RuleContext<'_>
pub fn siblings_post(&self) -> Vec<ErasedSegment>
Trait Implementations§
source§impl<'a> Clone for RuleContext<'a>
impl<'a> Clone for RuleContext<'a>
source§fn clone(&self) -> RuleContext<'a>
fn clone(&self) -> RuleContext<'a>
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 moreAuto Trait Implementations§
impl<'a> Freeze for RuleContext<'a>
impl<'a> !RefUnwindSafe for RuleContext<'a>
impl<'a> !Send for RuleContext<'a>
impl<'a> !Sync for RuleContext<'a>
impl<'a> Unpin for RuleContext<'a>
impl<'a> !UnwindSafe for RuleContext<'a>
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> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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>
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 more