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§

source§

impl Indent

source

pub fn new(_position_maker: PositionMarker) -> Self

Trait Implementations§

source§

impl Clone for Indent

source§

fn clone(&self) -> Indent

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Indent

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Indent

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Hash for Indent

source§

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

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

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Matchable for Indent

source§

fn is_optional(&self) -> bool

source§

fn simple( &self, parse_context: &ParseContext, crumbs: Option<Vec<&str>> ) -> Option<(HashSet<String>, HashSet<String>)>

source§

fn match_segments( &self, segments: Vec<Box<dyn Segment>>, parse_context: &mut ParseContext ) -> Result<MatchResult, SQLParseError>

source§

fn cache_key(&self) -> String

source§

fn from_segments(&self, segments: Vec<Box<dyn Segment>>) -> Box<dyn Matchable>

source§

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

source§

fn eq(&self, other: &Indent) -> 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 Segment for Indent

source§

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

source§

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

source§

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

Iterate raw segments, mostly for searching. Read more
source§

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

source§

fn is_meta(&self) -> bool

source§

fn is_code(&self) -> bool

source§

fn is_comment(&self) -> bool

source§

fn is_whitespace(&self) -> bool

source§

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

source§

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>

Stub.
source§

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

source§

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

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_upper(&self) -> Option<String>

source§

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

source§

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

source§

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

source§

fn segments(&self) -> &[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 iter_source_fix_patches( &self, templated_file: &TemplatedFile ) -> Vec<FixPatch>

Yield any source patches as fixes now. Read more
source§

fn indent_val(&self) -> usize

source§

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>

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>)>

source§

impl StructuralPartialEq for Indent

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> Boxed for T

source§

fn boxed(self) -> Box<T>

source§

impl<T> CloneSegment for T
where T: Segment + DynClone,

source§

fn clone_box(&self) -> Box<dyn Segment>

source§

impl<T> Config for T

source§

fn config(self, f: impl FnOnce(&mut Self)) -> Self

source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> DynEq for T
where T: Any + PartialEq,

source§

fn as_any(&self) -> &(dyn Any + 'static)

source§

fn dyn_eq(&self, other: &(dyn DynEq + 'static)) -> bool

source§

impl<T> DynHash for T
where T: Hash + ?Sized,

source§

fn hash(&self, state: &mut dyn Hasher)

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToMatchable for T
where T: Matchable,

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.