Struct TaggedString

Source
pub struct TaggedString {
    pub styled_text: (U16String, Vec<u8>),
    pub sections: Vec<SectionOptions>,
    pub supports_vertical_writing_mode: Option<bool>,
    pub image_section_id: u16,
}
Expand description

A TaggedString is the shaping-code counterpart of the Formatted type Whereas Formatted matches the logical structure of a ‘format’ expression, a TaggedString represents the same data at a per-character level so that character-rearranging operations (e.g. BiDi) preserve formatting. Text is represented as:

  • A string of characters
  • A matching array of indices, pointing to:
  • An array of SectionsOptions, representing the evaluated formatting options of the original sections.

Once the guts of a TaggedString have been re-arranged by BiDi, you can iterate over the contents in order, using getCharCodeAt and getSection to get the formatting options for each character in turn. maplibre/maplibre-native#4add9ea original name: TaggedString

Fields§

§styled_text: (U16String, Vec<u8>)§sections: Vec<SectionOptions>§supports_vertical_writing_mode: Option<bool>§image_section_id: u16

Implementations§

Source§

impl TaggedString

Source

const WHITESPACE_CHARS: &'static [u16]

Source

pub fn new_from_raw(text_: U16String, options: SectionOptions) -> Self

maplibre/maplibre-native#4add9ea original name: new_from_raw

Source

pub fn new( styled_text: (U16String, Vec<u8>), sections_: Vec<SectionOptions>, ) -> Self

maplibre/maplibre-native#4add9ea original name: new

Source

pub fn length(&self) -> usize

maplibre/maplibre-native#4add9ea original name: length

Source

pub fn section_count(&self) -> usize

maplibre/maplibre-native#4add9ea original name: sectionCount

Source

pub fn empty(&self) -> bool

maplibre/maplibre-native#4add9ea original name: empty

Source

pub fn get_section(&self, index: usize) -> &SectionOptions

maplibre/maplibre-native#4add9ea original name: getSection

Source

pub fn get_char_code_at(&self, index: usize) -> u16

maplibre/maplibre-native#4add9ea original name: getCharCodeAt

Source

pub fn raw_text(&self) -> &U16String

maplibre/maplibre-native#4add9ea original name: rawText

Source

pub fn get_styled_text(&self) -> &(U16String, Vec<u8>)

maplibre/maplibre-native#4add9ea original name: getStyledText

Source

pub fn add_text_section( &mut self, section_text: &U16String, scale: f64, font_stack: Vec<String>, text_color: Option<Color>, )

maplibre/maplibre-native#4add9ea original name: addTextSection

Source

pub fn add_image_section(&mut self, image_id: String)

maplibre/maplibre-native#4add9ea original name: addImageSection

Source

pub fn section_at(&self, index: usize) -> &SectionOptions

maplibre/maplibre-native#4add9ea original name: sectionAt

Source

pub fn get_sections(&self) -> &Vec<SectionOptions>

maplibre/maplibre-native#4add9ea original name: getSections

Source

pub fn get_section_index(&self, character_index: usize) -> u8

maplibre/maplibre-native#4add9ea original name: getSectionIndex

Source

pub fn get_max_scale(&self) -> f64

maplibre/maplibre-native#4add9ea original name: getMaxScale

Source

pub fn trim(&mut self)

maplibre/maplibre-native#4add9ea original name: trim

Source

pub fn verticalize_punctuation(&mut self)

maplibre/maplibre-native#4add9ea original name: verticalizePunctuation

Source

pub fn allows_vertical_writing_mode(&mut self) -> bool

maplibre/maplibre-native#4add9ea original name: allowsVerticalWritingMode

Source§

impl TaggedString

Source

fn get_next_image_section_char_code(&mut self) -> Option<u16>

maplibre/maplibre-native#4add9ea original name: getNextImageSectionCharCode

Trait Implementations§

Source§

impl Clone for TaggedString

Source§

fn clone(&self) -> TaggedString

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for TaggedString

Source§

fn default() -> Self

Returns an empty string maplibre/maplibre-native#4add9ea original name: default

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<G1, G2> Within<G2> for G1
where G2: Contains<G1>,

§

fn is_within(&self, b: &G2) -> bool

Source§

impl<T> Resource for T
where T: 'static,

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,