Struct TextSelection
pub struct TextSelection {
pub base: i64,
pub extent: i64,
pub affinity: TextAffinity,
}
Expand description
A range of text that represents a selection. Although strings in FIDL’s wire format are UTF-8 encoded, these indices are measured in UTF-16 code units for legacy reasons. These text input APIs will eventually be replaced by fuchsia.ui.text, which uses code points instead.
Text selection is always directional. Direction should be determined by comparing base and extent.
Fields§
§base: i64
The offset at which the selection originates, as measured in UTF-16 code units.
Might be larger than, smaller than, or equal to extent.
extent: i64
The offset at which the selection terminates, as measured in UTF-16 code units.
When the user uses the arrow keys to adjust the selection, this is the value that changes. Similarly, if the current theme paints a caret on one side of the selection, this is the location at which to paint the caret.
Might be larger than, smaller than, or equal to base.
affinity: TextAffinity
If the text range is collapsed and has more than one visual location (e.g., occurs at a line break), which of the two locations to use when painting the caret.
Trait Implementations§
§impl Clone for TextSelection
impl Clone for TextSelection
§fn clone(&self) -> TextSelection
fn clone(&self) -> TextSelection
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl Debug for TextSelection
impl Debug for TextSelection
§impl<D> Decode<TextSelection, D> for TextSelectionwhere
D: ResourceDialect,
impl<D> Decode<TextSelection, D> for TextSelectionwhere
D: ResourceDialect,
§fn new_empty() -> TextSelection
fn new_empty() -> TextSelection
Self
. The specific value does not matter,
since it will be overwritten by decode
.§impl<D> Encode<TextSelection, D> for &TextSelectionwhere
D: ResourceDialect,
impl<D> Encode<TextSelection, D> for &TextSelectionwhere
D: ResourceDialect,
§impl Hash for TextSelection
impl Hash for TextSelection
§impl Ord for TextSelection
impl Ord for TextSelection
§impl PartialEq for TextSelection
impl PartialEq for TextSelection
§impl PartialOrd for TextSelection
impl PartialOrd for TextSelection
§impl TypeMarker for TextSelection
impl TypeMarker for TextSelection
§type Owned = TextSelection
type Owned = TextSelection
§fn inline_align(_context: Context) -> usize
fn inline_align(_context: Context) -> usize
§fn inline_size(_context: Context) -> usize
fn inline_size(_context: Context) -> usize
inline_align
.§fn encode_is_copy() -> bool
fn encode_is_copy() -> bool
Self::Owned
matches the FIDL wire
format and encoding requires no validation. When true, we can optimize
encoding arrays and vectors of Self::Owned
to a single memcpy. Read more§fn decode_is_copy() -> bool
fn decode_is_copy() -> bool
Self::Owned
matches the FIDL wire
format and decoding requires no validation. When true, we can optimize
decoding arrays and vectors of Self::Owned
to a single memcpy.§impl ValueTypeMarker for TextSelection
impl ValueTypeMarker for TextSelection
§type Borrowed<'a> = &'a TextSelection
type Borrowed<'a> = &'a TextSelection
Encode<Self>
type cheaply obtainable from &Self::Owned
. There are three cases: Read more§fn borrow(
value: &<TextSelection as TypeMarker>::Owned,
) -> <TextSelection as ValueTypeMarker>::Borrowed<'_>
fn borrow( value: &<TextSelection as TypeMarker>::Owned, ) -> <TextSelection as ValueTypeMarker>::Borrowed<'_>
&Self::Owned
to Self::Borrowed
.