pub struct Indent {
pub indent_val: usize,
pub is_implicit: bool,
/* private fields */
}
Expand description
A segment which is empty but indicates where an indent should be.
This segment is always empty, i.e. its raw format is '', but it
indicates the position of a theoretical indent which will be used in linting and reconstruction. Even if there is an actual indent that occurs in the same place this intentionally won’t capture it, they will just be compared later.
Fields§
§indent_val: usize
§is_implicit: bool
Implementations§
Trait Implementations§
source§impl Matchable for Indent
impl Matchable for Indent
fn is_optional(&self) -> bool
fn simple( &self, parse_context: &ParseContext, crumbs: Option<Vec<&str>> ) -> Option<(HashSet<String>, HashSet<String>)>
fn match_segments( &self, segments: Vec<Box<dyn Segment>>, parse_context: &mut ParseContext ) -> Result<MatchResult, SQLParseError>
fn cache_key(&self) -> String
fn from_segments(&self, segments: Vec<Box<dyn Segment>>) -> Box<dyn Matchable>
fn copy( &self, insert: Option<Vec<Box<dyn Matchable>>>, replace_terminators: bool, terminators: Vec<Box<dyn Matchable>> ) -> Box<dyn Matchable>
source§impl PartialEq for Indent
impl PartialEq for Indent
source§impl Segment for Indent
impl Segment for Indent
fn new(&self, _segments: Vec<Box<dyn Segment>>) -> Box<dyn Segment>
fn get_segments(&self) -> Vec<Box<dyn Segment>>
source§fn get_raw_segments(&self) -> Vec<Box<dyn Segment>>
fn get_raw_segments(&self) -> Vec<Box<dyn Segment>>
Iterate raw segments, mostly for searching. Read more
fn get_type(&self) -> &'static str
fn is_meta(&self) -> bool
fn is_code(&self) -> bool
fn is_comment(&self) -> bool
fn is_whitespace(&self) -> bool
fn get_position_marker(&self) -> Option<PositionMarker>
fn set_position_marker(&mut self, position_marker: Option<PositionMarker>)
source§fn edit(
&self,
_raw: Option<String>,
_source_fixes: Option<Vec<SourceFix>>
) -> Box<dyn Segment>
fn edit( &self, _raw: Option<String>, _source_fixes: Option<Vec<SourceFix>> ) -> Box<dyn Segment>
Stub.
fn get_uuid(&self) -> Option<Uuid>
fn get_raw(&self) -> Option<String>
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_upper(&self) -> Option<String>
fn first_non_whitespace_segment_raw_upper(&self) -> Option<String>
fn is_type(&self, type_: &str) -> bool
fn get_default_raw(&self) -> Option<&'static str>
fn segments(&self) -> &[Box<dyn Segment>]
source§fn get_matched_length(&self) -> usize
fn get_matched_length(&self) -> usize
Return the length of the segment in characters.
source§fn get_can_start_end_non_code(&self) -> bool
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
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>
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 iter_source_fix_patches(
&self,
templated_file: &TemplatedFile
) -> Vec<FixPatch>
fn iter_source_fix_patches( &self, templated_file: &TemplatedFile ) -> Vec<FixPatch>
Yield any source patches as fixes now. Read more
fn indent_val(&self) -> usize
source§fn get_source_fixes(&self) -> Vec<SourceFix>
fn get_source_fixes(&self) -> Vec<SourceFix>
Return any source fixes as list.
source§fn compute_anchor_edit_info(
&self,
fixes: &Vec<LintFix>
) -> HashMap<Uuid, AnchorEditInfo>
fn compute_anchor_edit_info( &self, fixes: &Vec<LintFix> ) -> HashMap<Uuid, AnchorEditInfo>
Group and count fixes by anchor, return dictionary.
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>)>
impl StructuralPartialEq for Indent
Auto Trait Implementations§
impl RefUnwindSafe for Indent
impl Send for Indent
impl Sync for Indent
impl Unpin for Indent
impl UnwindSafe for Indent
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