Struct wtf8_rs::Wtf8[][src]

#[repr(transparent)]
pub struct Wtf8 { /* fields omitted */ }
Expand description

A WTF-8 slice.

Implementations

Coerces into a Wtf8. This accepts an &str argument.

Returns the length, in WTF-8 bytes.

Returns whether this is empty.

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.

Returns an iterator for the string’s code points.

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

Returns Err(_) if the string contains surrogates.

This does not copy the data.

Converts this string into a iterator of Wtf8Chunk.

The resulting iterator will intercalate Utf8 chunks with one or more UnpairedSurrogate and all contained codepoints can be recovered from it.

Lossily converts the string to UTF-8. Returns a UTF-8 &str slice if the contents are well-formed in UTF-8.

Surrogates are replaced with "\u{FFFD}" (the replacement character “�”).

This only copies the data if necessary (if it contains any surrogate).

Returns a slice of the given string for the byte range.

Returns None whenever index would panic.

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

Returns a slice of the given string for the byte range.

Safety

Produces undefined behaviour whenever index would panic.

Whether a given index is at a code point boundary.

Boxes this Wtf8.

Creates a boxed, empty Wtf8.

Boxes this Wtf8 with Arc.

Boxes this Wtf8 with Rc.

Converts this slice to its ASCII lower case equivalent in-place.

ASCII letters ‘A’ to ‘Z’ are mapped to ‘a’ to ‘z’, but non-ASCII letters are unchanged.

To return a new lowercased value without modifying the existing one, use to_ascii_lowercase.

Converts this slice to its ASCII upper case equivalent in-place.

ASCII letters ‘a’ to ‘z’ are mapped to ‘A’ to ‘Z’, but non-ASCII letters are unchanged.

To return a new uppercased value without modifying the existing one, use to_ascii_uppercase.

Returns a Wtf8Buf containing a copy of this slice where each byte is mapped to its ASCII lower case equivalent.

ASCII letters ‘A’ to ‘Z’ are mapped to ‘a’ to ‘z’, but non-ASCII letters are unchanged.

Returns a Wtf8Buf containing a copy of this slice where each byte is mapped to its ASCII upper case equivalent.

ASCII letters ‘a’ to ‘z’ are mapped to ‘A’ to ‘Z’, but non-ASCII letters are unchanged.

To uppercase the value in-place, use make_ascii_uppercase.

Checks if all bytes in this slice are within the ASCII range.

Checks that two slices are an ASCII case-insensitive match.

Same as to_ascii_lowercase(a) == to_ascii_lowercase(b), but without allocating and copying temporaries.

Trait Implementations

Performs the conversion.

Performs the conversion.

Performs the conversion.

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Extends a collection with the contents of an iterator. Read more

🔬 This is a nightly-only experimental API. (extend_one)

Extends a collection with exactly one element.

🔬 This is a nightly-only experimental API. (extend_one)

Reserves capacity in a collection for the given number of additional elements. Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Creates a value from an iterator. Read more

Returns a slice of the given string for the byte range.

Panics

Panics when the boundaries of the range 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. Read more

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

Restrict a value to a certain interval. Read more

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

This method tests for !=.

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

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Converts the given value to a String. Read more