pub struct Selections { /* private fields */ }Expand description
The list of Selections in a Text
This list can contain any number of Selections, and they
should be usable in whatever order the end user may want, without
breaking from, for example, modifications that should move cursors
backwards or ahead. If that is not the case, report it as a bug.
they are primarily meant to be interacted with from the
Handle, with its edit_ methods meant to efficiently
handle a large number of Selections in an efficient manner,
although you can interact with them separately.
A Text will keep itself in check with regards to its
Selections, that is, it will automatically remove and add the
MainCaret and ExtraCaret tags when the Selections
are altered. If it fails to do that, report it as a bug.
Implementations§
Source§impl Selections
impl Selections
Sourcepub fn rotate_main(&mut self, amount: i32)
pub fn rotate_main(&mut self, amount: i32)
Rotates the main Selection by an amount
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Removes all Selections and adds a default Selection as
main
Sourcepub fn remove_extras(&mut self)
pub fn remove_extras(&mut self)
Removes all but the main Selection
Sourcepub fn main(&self) -> &Selection
pub fn main(&self) -> &Selection
Gets the main Selection
§Panics
This method will panic if there are no Selections. If you
want a non-panicking method, see Selections::get_main.
Sourcepub fn get_main(&self) -> Option<&Selection>
pub fn get_main(&self) -> Option<&Selection>
Gets the main Selection, if there is one
If you want a method that doesn’t return an Option (for
convenience), see Selections::main.
Sourcepub fn iter_within(
&self,
range: impl TextRange,
) -> impl Iterator<Item = (usize, &Selection, bool)>
pub fn iter_within( &self, range: impl TextRange, ) -> impl Iterator<Item = (usize, &Selection, bool)>
Sourcepub fn main_index(&self) -> usize
pub fn main_index(&self) -> usize
The index of the main Selection
Trait Implementations§
Source§impl Clone for Selections
impl Clone for Selections
Auto Trait Implementations§
impl !Freeze for Selections
impl RefUnwindSafe for Selections
impl Send for Selections
impl Sync for Selections
impl Unpin for Selections
impl UnwindSafe for Selections
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.