[−][src]Struct druid::text::selection::Selection
A Selection type for EditableText.
Fields
start: usize
The inactive edge of a selection, as a byte offset. When equal to end, the selection range acts as a caret.
end: usize
The active edge of a selection, as a byte offset.
h_pos: Option<f64>
The saved horizontal position, during vertical movement.
Implementations
impl Selection
[src]
pub fn new(start: usize, end: usize) -> Self
[src]
Create a selection that begins at start and goes to end. Like dragging a mouse from start to end.
#[must_use = "constrained constructs a new Selection"]pub fn constrained(self, s: &impl EditableText) -> Self
[src]
Create a new selection that is guaranteed to be valid for the provided text.
pub fn caret(pos: usize) -> Self
[src]
Create a caret, which is just a selection with the same and start and end.
pub fn with_h_pos(self, h_pos: Option<f64>) -> Self
[src]
Construct a new selection from this selection, with the provided h_pos.
pub fn is_caret(self) -> bool
[src]
If start == end, it's a caret
pub fn min(self) -> usize
[src]
Return the smallest index (left, in left-to-right languages)
pub fn max(self) -> usize
[src]
Return the largest index (right, in left-to-right languages)
pub fn range(self) -> Range<usize>
[src]
Return a range from smallest to largest index
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Selection
[src]
impl Send for Selection
[src]
impl Sync for Selection
[src]
impl Unpin for Selection
[src]
impl UnwindSafe for Selection
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> RoundFrom<T> for T
pub fn round_from(x: T) -> T
impl<T, U> RoundInto<U> for T where
U: RoundFrom<T>,
U: RoundFrom<T>,
pub fn round_into(self) -> U
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,