pub struct CommentSegment { /* private fields */ }
Expand description

Segment containing a comment.

Implementations§

source§

impl CommentSegment

source

pub fn new( raw: &str, position_maker: &PositionMarker, args: CommentSegmentNewArgs ) -> Box<dyn Segment>

Trait Implementations§

source§

impl Clone for CommentSegment

source§

fn clone(&self) -> CommentSegment

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 CommentSegment

source§

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

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

impl Hash for CommentSegment

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 PartialEq for CommentSegment

source§

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

source§

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

source§

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

source§

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

source§

fn is_code(&self) -> bool

source§

fn is_comment(&self) -> bool

source§

fn is_whitespace(&self) -> bool

source§

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

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_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_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 is_meta(&self) -> 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 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 CommentSegment

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