Struct r3bl_rs_utils::SelectionMap 
source · pub struct SelectionMap {
    pub map: HashMap<ChUnit, SelectionRange>,
    pub maybe_previous_direction: Option<CaretMovementDirection>,
}Expand description
Key is the row index, value is the selected range in that line (display col index range).
Note that both column indices are:
- Scroll adjusted.
 - And not raw.
 
Fields§
§map: HashMap<ChUnit, SelectionRange>§maybe_previous_direction: Option<CaretMovementDirection>Implementations§
source§impl SelectionMap
 
impl SelectionMap
pub fn get_caret_at_start_of_range( &self, _with: DeleteSelectionWith ) -> Option<Position>
pub fn get_selected_lines<'a>( &self, buffer: &'a EditorBuffer ) -> HashMap<ChUnit, &'a str>
pub fn get_ordered_indices(&self) -> Vec<ChUnit>
pub fn is_empty(&self) -> bool
pub fn clear(&mut self)
pub fn iter(&self) -> impl Iterator<Item = (&ChUnit, &SelectionRange)>
pub fn get(&self, row_index: ChUnit) -> Option<&SelectionRange>
sourcepub fn has_caret_movement_direction_changed(
    &self,
    current_direction: CaretMovementDirection
) -> DirectionChangeResult
 
pub fn has_caret_movement_direction_changed( &self, current_direction: CaretMovementDirection ) -> DirectionChangeResult
Compares the given direction (current_direction) with the
maybe_previous_direction.
- If there is no existing previous direction, it returns DirectionChangeResult::DirectionIsTheSame.
 - Otherwise it compares the two and returns DirectionChangeResult (whether the direction has changed or not).
 
pub fn insert( &mut self, row_index: ChUnit, selection_range: SelectionRange, direction: CaretMovementDirection )
pub fn remove(&mut self, row_index: ChUnit, direction: CaretMovementDirection)
pub fn update_previous_direction(&mut self, direction: CaretMovementDirection)
pub fn remove_previous_direction(&mut self)
sourcepub fn locate_row(&self, row_index_arg: ChUnit) -> RowLocationInSelectionMap
 
pub fn locate_row(&self, row_index_arg: ChUnit) -> RowLocationInSelectionMap
Is there a selection range for the row_index of row_index_arg in the map?
- The map contains key value pairs of RowIndex and SelectionRange.
 - So if the row_index can’t be found in the map, it means that the row is not selected, aka RowLocationInSelectionMap::Overflow.
 - Otherwise it means that some range of columns in that row is selected, aka RowLocationInSelectionMap::Contained.
 
source§impl SelectionMap
 
impl SelectionMap
pub fn to_formatted_string(&self) -> StyledContent<String>
pub fn to_unformatted_string(&self) -> String
Trait Implementations§
source§impl Clone for SelectionMap
 
impl Clone for SelectionMap
source§fn clone(&self) -> SelectionMap
 
fn clone(&self) -> SelectionMap
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 moresource§impl Debug for SelectionMap
 
impl Debug for SelectionMap
source§impl Default for SelectionMap
 
impl Default for SelectionMap
source§fn default() -> SelectionMap
 
fn default() -> SelectionMap
Returns the “default value” for a type. Read more
source§impl<'de> Deserialize<'de> for SelectionMap
 
impl<'de> Deserialize<'de> for SelectionMap
source§fn deserialize<__D>(
    __deserializer: __D
) -> Result<SelectionMap, <__D as Deserializer<'de>>::Error>where
    __D: Deserializer<'de>,
 
fn deserialize<__D>( __deserializer: __D ) -> Result<SelectionMap, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Display for SelectionMap
 
impl Display for SelectionMap
source§impl GetSize for SelectionMap
 
impl GetSize for SelectionMap
source§fn get_heap_size(&self) -> usize
 
fn get_heap_size(&self) -> usize
Determines how many bytes this object occupies inside the heap. Read more
source§fn get_stack_size() -> usize
 
fn get_stack_size() -> usize
Determines how may bytes this object occupies inside the stack. Read more
source§impl PartialEq for SelectionMap
 
impl PartialEq for SelectionMap
source§fn eq(&self, other: &SelectionMap) -> bool
 
fn eq(&self, other: &SelectionMap) -> bool
This method tests for 
self and other values to be equal, and is used
by ==.source§impl Serialize for SelectionMap
 
impl Serialize for SelectionMap
source§fn serialize<__S>(
    &self,
    __serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
    __S: Serializer,
 
fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where __S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for SelectionMap
Auto Trait Implementations§
impl RefUnwindSafe for SelectionMap
impl Send for SelectionMap
impl Sync for SelectionMap
impl Unpin for SelectionMap
impl UnwindSafe for SelectionMap
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