FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    WordSegment

    struct · ferroui-base · v0.5.0

    struct WordSegment<'a>
    

    Represents a segment between two Unicode word boundaries.

    View source

    Members

    new

    const fn new(offset: usize, length: usize, codepoint_offset: usize, codepoint_length: usize) -> Self
    

    Initializes a new instance of the WordSegment struct.

    • offset - The segment offset in UTF-16 code units.
    • length - The segment length in UTF-16 code units.
    • codepoint_offset - The segment offset in Unicode code points.
    • codepoint_length - The segment length in Unicode code points.

    Segments created through this constructor carry no WordSegment::text slice.

    Source

    with_text

    const fn with_text(offset: usize, text: &'a [u16], codepoint_offset: usize, codepoint_length: usize) -> Self
    

    Initializes a new instance of the WordSegment struct.

    • offset - The segment start offset in UTF-16 code units within the source span.
    • text - The slice of the source span that makes up this segment.
    • codepoint_offset - The segment offset in Unicode code points.
    • codepoint_length - The segment length in Unicode code points.

    Source

    offset

    const fn offset(self: &Self) -> usize
    

    Gets the segment offset in UTF-16 code units.

    Source

    length

    const fn length(self: &Self) -> usize
    

    Gets the segment length in UTF-16 code units.

    Source

    codepoint_offset

    const fn codepoint_offset(self: &Self) -> usize
    

    Gets the segment offset in Unicode code points.

    Source

    codepoint_length

    const fn codepoint_length(self: &Self) -> usize
    

    Gets the segment length in Unicode code points.

    Source

    text

    const fn text(self: &Self) -> &'a [u16]
    

    Gets the text content of this segment as a slice of the source span.

    Empty for segments created through the constructor that takes a code-unit length instead of a slice, whose source span is unknown. Use WordSegment::length when the segment may come from an arbitrary caller rather than from the word break enumerator.

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • PropertyValue
    • AnyValue
    • ClassDefaults
    • Borrow<T>
    • BorrowMut<T>
    • CloneToUninit
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ToOwned
    • ErasedDestructor
    • IntoEither
    • Clone
    • Copy
    • Debug
    • Default
    • StructuralPartialEq
    • PartialEq
    • Eq

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.