Struct pattern_3::Wtf8[][src]

pub struct Wtf8 { /* fields omitted */ }

A borrowed slice of well-formed WTF-8 data.

Similar to &str, but can additionally contain surrogate code points if they’re not in a surrogate pair.

Methods

impl Wtf8
[src]

Creates a WTF-8 slice from a UTF-8 &str slice.

Since WTF-8 is a superset of UTF-8, this always succeeds.

Creates a WTF-8 slice from a WTF-8 byte slice.

Since the byte slice is not checked for valid WTF-8, this functions is marked unsafe.

Returns the length, in WTF-8 bytes.

Returns the code point at position if it is in the ASCII range, or `b'\xFF' otherwise.

Panics

Panics if position is beyond the end of the string.

Tries to convert the string to UTF-8 and return a &str slice.

Returns None if the string contains surrogates.

This does not copy the data.

Converts the WTF-8 string to potentially ill-formed UTF-16 and return an iterator of 16-bit code units.

This is lossless: calling Wtf8Buf::from_ill_formed_utf16 on the resulting code units would always return the original WTF-8 string.

impl Wtf8
[src]

Trait Implementations

impl Debug for Wtf8
[src]

Format the slice with double quotes, and surrogates as \u followed by four hexadecimal digits. Example: "a\u{D800}" for a slice with code points [U+0061, U+D800]

Formats the value using the given formatter. Read more

impl Display for Wtf8
[src]

Formats the value using the given formatter. Read more

impl PartialEq for Wtf8
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Eq for Wtf8
[src]

impl PartialOrd for Wtf8
[src]

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Ord for Wtf8
[src]

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

impl Index<Range<usize>> for Wtf8
[src]

Return a slice of the given string for the byte range [begin..end).

Panics

Panics when begin and end do not point to code point boundaries, or point beyond the end of the string.

The returned type after indexing.

Performs the indexing (container[index]) operation.

impl Index<RangeFrom<usize>> for Wtf8
[src]

Return a slice of the given string from byte begin to its end.

Panics

Panics when begin is not at a code point boundary, or is beyond the end of the string.

The returned type after indexing.

Performs the indexing (container[index]) operation.

impl Index<RangeTo<usize>> for Wtf8
[src]

Return a slice of the given string from its beginning to byte end.

Panics

Panics when end is not at a code point boundary, or is beyond the end of the string.

The returned type after indexing.

Performs the indexing (container[index]) operation.

impl Index<RangeFull> for Wtf8
[src]

The returned type after indexing.

Performs the indexing (container[index]) operation.

impl Hash for Wtf8
[src]

Feeds this value into the given [Hasher]. Read more

Feeds a slice of this type into the given [Hasher]. Read more

impl<'h, 'p> Pattern<&'h Wtf8> for &'p Wtf8
[src]

The searcher associated with this pattern.

The checker associated with this pattern.

Produces a searcher for this pattern.

Produces a checker for this pattern.

impl<'h, 'p> Pattern<&'h Wtf8> for &'p str
[src]

The searcher associated with this pattern.

The checker associated with this pattern.

Produces a searcher for this pattern.

Produces a checker for this pattern.

impl Hay for Wtf8
[src]

The index type of the haystack. Typically a usize. Read more

Creates an empty haystack.

Obtains the index to the start of the hay. Read more

Obtains the index to the end of the hay. Read more

Obtains a child hay by slicing self. Read more

Returns the next immediate index in this haystack. Read more

Returns the previous immediate index in this haystack. Read more

Auto Trait Implementations

impl Send for Wtf8

impl Sync for Wtf8