struct

Pf::GraphemeView

Inherits Struct / Value / Object

Represents a single grapheme as a view into a string.

NOTE: GraphemeView, just like GraphemeSeln, refers back to the trunk string, which could be very large. This may prevent the GC from freeing large chunks of memory due to a small number of grapheme views that refer to it. For this reason, you are advised not to store GraphemeViews on the heap unless you know for sure their lifetime is less than or equal to the lifetime of the trunk string. Otherwise, use to_grapheme. In general, when working with GraphemeView, the reasoning should be the same as with GraphemeSeln; in that they carry around, at least conceptually, the larger context as well.

EXPERIMENTAL: Relies on features from the experimental String::Grapheme API.

Instance methods

==(other : Char) : Bool

Returns true if this view consists only of the character other.

Source
==(other : String) : Bool

Compares the contents of this view with other, bytewise.

Source
byte_end

Returns the byte index of this grapheme in the trunk string.

Source
byte_range

Returns an exclusive range of the indices of the contituent bytes of this grapheme in the trunk string.

Source
byte_start

Returns the byte index of this grapheme in the trunk string.

Source
bytesize

Returns the size of this grapheme in bytes.

Source
inspect(io)
Source
to_grapheme

Converts this view to a String::Grapheme.

Source
to_s(io)
Source
to_slice

Returns a read-only view of the underling bytes of this grapheme. The view is a subview of the trunk string's bytes.

Source