pub trait Segment: Any + DynEq + DynClone + DynHash + Debug + CloneSegment {
Show 44 methods // Provided methods fn new(&self, _segments: Vec<Box<dyn Segment>>) -> Box<dyn Segment> { ... } fn select_children( &self, start_seg: Option<&Box<dyn Segment>>, stop_seg: Option<&Box<dyn Segment>>, select_if: Option<fn(_: &dyn Segment) -> bool>, loop_while: Option<fn(_: &dyn Segment) -> bool> ) -> Vec<Box<dyn Segment>> { ... } fn is_templated(&self) -> bool { ... } fn iter_segments( &self, expanding: Option<&[&str]>, pass_through: bool ) -> Vec<Box<dyn Segment>> { ... } fn recursive_crawl_all(&self, reverse: bool) -> Vec<Box<dyn Segment>> { ... } fn print_tree(&self) { ... } fn code_indices(&self) -> Vec<usize> { ... } fn get_parent(&self) -> Option<Box<dyn Segment>> { ... } fn child(&self, seg_types: &[&str]) -> Option<Box<dyn Segment>> { ... } fn children(&self, seg_types: &[&str]) -> Vec<Box<dyn Segment>> { ... } fn path_to(&self, other: &Box<dyn Segment>) -> Vec<PathStep> { ... } fn iter_patches(&self, templated_file: &TemplatedFile) -> Vec<FixPatch> { ... } fn descendant_type_set(&self) -> HashSet<String> { ... } fn match_grammar(&self) -> Option<Box<dyn Matchable>> { ... } fn get_raw(&self) -> Option<String> { ... } fn get_raw_upper(&self) -> Option<String> { ... } fn first_non_whitespace_segment_raw_upper(&self) -> Option<String> { ... } fn get_type(&self) -> &'static str { ... } fn is_type(&self, type_: &str) -> bool { ... } fn is_code(&self) -> bool { ... } fn is_comment(&self) -> bool { ... } fn is_whitespace(&self) -> bool { ... } fn is_meta(&self) -> bool { ... } fn get_default_raw(&self) -> Option<&'static str> { ... } fn get_position_marker(&self) -> Option<PositionMarker> { ... } fn set_position_marker(&mut self, position_marker: Option<PositionMarker>) { ... } fn segments(&self) -> &[Box<dyn Segment>] { ... } fn get_segments(&self) -> Vec<Box<dyn Segment>> { ... } fn get_matched_length(&self) -> usize { ... } fn get_can_start_end_non_code(&self) -> bool { ... } fn get_allow_empty(&self) -> bool { ... } fn get_file_path(&self) -> Option<String> { ... } fn get_raw_segments(&self) -> Vec<Box<dyn Segment>> { ... } fn iter_source_fix_patches( &self, templated_file: &TemplatedFile ) -> Vec<FixPatch> { ... } fn get_uuid(&self) -> Option<Uuid> { ... } fn indent_val(&self) -> usize { ... } fn get_source_fixes(&self) -> Vec<SourceFix> { ... } fn edit( &self, raw: Option<String>, source_fixes: Option<Vec<SourceFix>> ) -> Box<dyn Segment> { ... } fn compute_anchor_edit_info( &self, fixes: &Vec<LintFix> ) -> HashMap<Uuid, AnchorEditInfo> { ... } fn instance_types(&self) -> HashSet<String> { ... } fn combined_types(&self) -> HashSet<String> { ... } fn class_types(&self) -> HashSet<String> { ... } fn apply_fixes( &self, dialect: Dialect, fixes: HashMap<Uuid, AnchorEditInfo> ) -> (Box<dyn Segment>, Vec<Box<dyn Segment>>, Vec<Box<dyn Segment>>, bool) { ... } fn raw_segments_with_ancestors( &self ) -> Vec<(Box<dyn Segment>, Vec<PathStep>)> { ... }
}

Provided Methods§

source

fn new(&self, _segments: Vec<Box<dyn Segment>>) -> Box<dyn Segment>

source

fn select_children( &self, start_seg: Option<&Box<dyn Segment>>, stop_seg: Option<&Box<dyn Segment>>, select_if: Option<fn(_: &dyn Segment) -> bool>, loop_while: Option<fn(_: &dyn Segment) -> bool> ) -> Vec<Box<dyn Segment>>

source

fn is_templated(&self) -> bool

source

fn iter_segments( &self, expanding: Option<&[&str]>, pass_through: bool ) -> Vec<Box<dyn Segment>>

source

fn recursive_crawl_all(&self, reverse: bool) -> Vec<Box<dyn Segment>>

source

fn print_tree(&self)

source

fn code_indices(&self) -> Vec<usize>

source

fn get_parent(&self) -> Option<Box<dyn Segment>>

source

fn child(&self, seg_types: &[&str]) -> Option<Box<dyn Segment>>

source

fn children(&self, seg_types: &[&str]) -> Vec<Box<dyn Segment>>

source

fn path_to(&self, other: &Box<dyn Segment>) -> Vec<PathStep>

source

fn iter_patches(&self, templated_file: &TemplatedFile) -> Vec<FixPatch>

source

fn descendant_type_set(&self) -> HashSet<String>

source

fn match_grammar(&self) -> Option<Box<dyn Matchable>>

source

fn get_raw(&self) -> Option<String>

source

fn get_raw_upper(&self) -> Option<String>

source

fn first_non_whitespace_segment_raw_upper(&self) -> Option<String>

source

fn get_type(&self) -> &'static str

source

fn is_type(&self, type_: &str) -> bool

source

fn is_code(&self) -> bool

source

fn is_comment(&self) -> bool

source

fn is_whitespace(&self) -> bool

source

fn is_meta(&self) -> bool

source

fn get_default_raw(&self) -> Option<&'static str>

source

fn get_position_marker(&self) -> Option<PositionMarker>

source

fn set_position_marker(&mut self, position_marker: Option<PositionMarker>)

source

fn segments(&self) -> &[Box<dyn Segment>]

source

fn get_segments(&self) -> Vec<Box<dyn Segment>>

source

fn get_matched_length(&self) -> usize

Return the length of the segment in characters.

source

fn get_can_start_end_non_code(&self) -> bool

Are we able to have non-code at the start or end?

source

fn get_allow_empty(&self) -> bool

Can we allow it to be empty? Usually used in combination with the can_start_end_non_code.

source

fn get_file_path(&self) -> Option<String>

get_file_path returns the file path of the segment if it is a file segment.

source

fn get_raw_segments(&self) -> Vec<Box<dyn Segment>>

Iterate raw segments, mostly for searching.

In sqlfluff only implemented for RawSegments and up

source

fn iter_source_fix_patches( &self, templated_file: &TemplatedFile ) -> Vec<FixPatch>

Yield any source patches as fixes now.

    NOTE: This yields source fixes for the segment and any of its
    children, so it's important to call it at the right point in
    the recursion to avoid yielding duplicates.
source

fn get_uuid(&self) -> Option<Uuid>

source

fn indent_val(&self) -> usize

source

fn get_source_fixes(&self) -> Vec<SourceFix>

Return any source fixes as list.

source

fn edit( &self, raw: Option<String>, source_fixes: Option<Vec<SourceFix>> ) -> Box<dyn Segment>

Stub.

source

fn compute_anchor_edit_info( &self, fixes: &Vec<LintFix> ) -> HashMap<Uuid, AnchorEditInfo>

Group and count fixes by anchor, return dictionary.

source

fn instance_types(&self) -> HashSet<String>

source

fn combined_types(&self) -> HashSet<String>

source

fn class_types(&self) -> HashSet<String>

source

fn apply_fixes( &self, dialect: Dialect, fixes: HashMap<Uuid, AnchorEditInfo> ) -> (Box<dyn Segment>, Vec<Box<dyn Segment>>, Vec<Box<dyn Segment>>, bool)

source

fn raw_segments_with_ancestors(&self) -> Vec<(Box<dyn Segment>, Vec<PathStep>)>

Trait Implementations§

source§

impl<'hash> Hash for dyn Segment + 'hash

source§

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

Feeds this value into the given Hasher. Read more
source§

impl<'hash> Hash for dyn Segment + Send + 'hash

source§

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

Feeds this value into the given Hasher. Read more
source§

impl<'hash> Hash for dyn Segment + Send + Sync + 'hash

source§

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

Feeds this value into the given Hasher. Read more
source§

impl<'hash> Hash for dyn Segment + Sync + 'hash

source§

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

Feeds this value into the given Hasher. Read more
source§

impl PartialEq for Box<dyn Segment>

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for Box<dyn Segment>

Implementors§