Enum TextAffinity
#[repr(u32)]pub enum TextAffinity {
Upstream = 0,
Downstream = 1,
}
Expand description
Whether a TextPosition is visually upstream or downstream of its offset.
For example, when a text position exists at a line break, a single offset has two visual positions, one prior to the line break (at the end of the first line) and one after the line break (at the start of the second line). A text affinity disambiguates between those cases. (Something similar happens with between runs of bidirectional text.)
We do not expect new values to be added to this enum.
Variants§
Upstream = 0
The position has affinity for the upstream side of the text position.
For example, if the offset of the text position is a line break, the position represents the end of the first line.
Downstream = 1
The position has affinity for the downstream side of the text position.
For example, if the offset of the text position is a line break, the position represents the start of the second line.
Implementations§
§impl TextAffinity
impl TextAffinity
pub fn from_primitive(prim: u32) -> Option<TextAffinity>
pub const fn into_primitive(self) -> u32
pub fn is_unknown(&self) -> bool
is_unknown
Trait Implementations§
§impl Clone for TextAffinity
impl Clone for TextAffinity
§fn clone(&self) -> TextAffinity
fn clone(&self) -> TextAffinity
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl Debug for TextAffinity
impl Debug for TextAffinity
§impl<D> Decode<TextAffinity, D> for TextAffinitywhere
D: ResourceDialect,
impl<D> Decode<TextAffinity, D> for TextAffinitywhere
D: ResourceDialect,
§fn new_empty() -> TextAffinity
fn new_empty() -> TextAffinity
Self
. The specific value does not matter,
since it will be overwritten by decode
.§impl<D> Encode<TextAffinity, D> for TextAffinitywhere
D: ResourceDialect,
impl<D> Encode<TextAffinity, D> for TextAffinitywhere
D: ResourceDialect,
§impl Hash for TextAffinity
impl Hash for TextAffinity
§impl Ord for TextAffinity
impl Ord for TextAffinity
§impl PartialEq for TextAffinity
impl PartialEq for TextAffinity
§impl PartialOrd for TextAffinity
impl PartialOrd for TextAffinity
§impl TypeMarker for TextAffinity
impl TypeMarker for TextAffinity
§type Owned = TextAffinity
type Owned = TextAffinity
§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 TextAffinity
impl ValueTypeMarker for TextAffinity
§type Borrowed<'a> = TextAffinity
type Borrowed<'a> = TextAffinity
Encode<Self>
type cheaply obtainable from &Self::Owned
. There are three cases: Read more§fn borrow(
value: &<TextAffinity as TypeMarker>::Owned,
) -> <TextAffinity as ValueTypeMarker>::Borrowed<'_>
fn borrow( value: &<TextAffinity as TypeMarker>::Owned, ) -> <TextAffinity as ValueTypeMarker>::Borrowed<'_>
&Self::Owned
to Self::Borrowed
.