pub struct SelectionSet { /* private fields */ }Expand description
Non-empty, sorted, non-overlapping selections plus the primary’s index.
Implementations§
Source§impl SelectionSet
impl SelectionSet
pub fn single(sel: Selection) -> Self
pub fn caret(pos: ByteOffset) -> Self
Sourcepub fn new(ranges: Vec<Selection>, primary: usize) -> Self
pub fn new(ranges: Vec<Selection>, primary: usize) -> Self
Builds a normalized set. primary indexes into ranges as given.
An empty ranges yields a caret at 0.
pub fn ranges(&self) -> &[Selection]
Sourcepub fn fits(&self, doc: &Document) -> bool
pub fn fits(&self, doc: &Document) -> bool
Whether this is a well-formed set for doc (non-empty, sorted, apart
from each other as normalizing leaves them, every end on a character
boundary of the text, a rectangle within its lines). A set read back
from disk is checked with this before it is used.
pub fn primary(&self) -> &Selection
pub fn primary_index(&self) -> usize
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn rect(&self) -> Option<&Rectangle>
pub fn with_rect(self, rect: Option<Rectangle>) -> Self
Trait Implementations§
Source§impl Clone for SelectionSet
impl Clone for SelectionSet
Source§impl Debug for SelectionSet
impl Debug for SelectionSet
Source§impl<'de> Deserialize<'de> for SelectionSet
impl<'de> Deserialize<'de> for SelectionSet
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for SelectionSet
Source§impl PartialEq for SelectionSet
impl PartialEq for SelectionSet
Source§impl Serialize for SelectionSet
impl Serialize for SelectionSet
impl StructuralPartialEq for SelectionSet
Auto Trait Implementations§
impl Freeze for SelectionSet
impl RefUnwindSafe for SelectionSet
impl Send for SelectionSet
impl Sync for SelectionSet
impl Unpin for SelectionSet
impl UnsafeUnpin for SelectionSet
impl UnwindSafe for SelectionSet
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