[][src]Struct quoted_string::spec::PartialCodePoint

pub struct PartialCodePoint(_);

A type which represents part of a utf-8 code point

It does not know which part of a code point it represents (e.g. utf-8 first or later byte of a code point > 0x7f).

When used in a iteration like context it is also not guaranteed to go through all utf-8 bytes, it might, or it might just represent the first byte replacing all bytes > 0x7f with 0xFF.

This allows efficiently abstracting over char sequences and utf-8 byte sequences for tasks which are mainly focused on us-ascii and treat all non ascii utf8 code points the same.

Methods

impl PartialCodePoint[src]

pub fn as_u8(self) -> u8[src]

pub fn from_utf8_byte(u8b: u8) -> PartialCodePoint[src]

creates a partial code point from a utf8 byte

The inner value will be the byte passed in, which should not be 0xff as 0xff doesn't appear in a utf-8 byte sequence

Debug Assertions

if debug assertions are enabled and 0xff is passed in this will panic as it wasn't created from a byte from a utf-8 byte sequence

pub fn from_code_point(code_point: u32) -> PartialCodePoint[src]

creates a PartialCodePoint from a utf-8 code point.

The inner value will be:

  • the char if the code point is us-ascii
  • 0xFF if it is larger then 0x7f i.e. non us-ascii

Trait Implementations

impl Clone for PartialCodePoint[src]

impl Copy for PartialCodePoint[src]

impl Eq for PartialCodePoint[src]

impl Ord for PartialCodePoint[src]

impl PartialEq<PartialCodePoint> for PartialCodePoint[src]

impl PartialOrd<PartialCodePoint> for PartialCodePoint[src]

impl Debug for PartialCodePoint[src]

impl Hash for PartialCodePoint[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]