Skip to main content

Utf8Encoding

Struct Utf8Encoding 

Source
pub struct Utf8Encoding;
Expand description

The UTF-8 encoding type behind ONIG_ENCODING_UTF8.

Trait Implementations§

Source§

impl Encoding for Utf8Encoding

Source§

fn mbc_enc_len(&self, p: &[u8]) -> usize

Returns the byte length of the multibyte character at position p.
Source§

fn name(&self) -> &str

Encoding name (e.g. “US-ASCII”, “UTF-8”)
Source§

fn max_enc_len(&self) -> usize

Maximum encoded character length in bytes
Source§

fn min_enc_len(&self) -> usize

Minimum encoded character length in bytes
Source§

fn is_mbc_newline(&self, p: &[u8], end: usize) -> bool

Is the byte at p a newline character?
Source§

fn mbc_to_code(&self, p: &[u8], end: usize) -> OnigCodePoint

Decode a multibyte character to a code point
Source§

fn code_to_mbclen(&self, code: OnigCodePoint) -> i32

Returns the byte length needed to encode a code point
Source§

fn code_to_mbc(&self, code: OnigCodePoint, buf: &mut [u8]) -> i32

Encode a code point into buf, returns number of bytes written
Source§

fn mbc_case_fold( &self, flag: OnigCaseFoldType, pp: &mut usize, end: usize, source: &[u8], fold_buf: &mut [u8], ) -> i32

Case fold the character at pp, advance pp, write folded to fold_buf. Returns the number of bytes written to fold_buf.
Source§

fn apply_all_case_fold( &self, flag: OnigCaseFoldType, f: &mut dyn FnMut(OnigCodePoint, &[OnigCodePoint]) -> i32, ) -> i32

Apply function f to all case fold pairs.
Source§

fn get_case_fold_codes_by_str( &self, flag: OnigCaseFoldType, p: &[u8], end: usize, items: &mut [OnigCaseFoldCodeItem], ) -> i32

Get case fold code alternatives for the character at p.
Source§

fn property_name_to_ctype(&self, p: &[u8]) -> i32

Convert property name to ctype value.
Source§

fn is_code_ctype(&self, code: OnigCodePoint, ctype: u32) -> bool

Is the code point of the given ctype?
Source§

fn get_ctype_code_range( &self, ctype: u32, sb_out: &mut OnigCodePoint, ) -> Option<&'static [OnigCodePoint]>

Get the code range for a ctype.
Source§

fn left_adjust_char_head(&self, start: usize, s: usize, data: &[u8]) -> usize

Left adjust char head: find the start of the character containing s within [start..].
Source§

fn is_allowed_reverse_match(&self, _p: &[u8]) -> bool

Is reverse matching allowed at this position?
Source§

fn is_valid_mbc_string(&self, s: &[u8]) -> bool

Validate that the byte string is valid for this encoding
Source§

fn flag(&self) -> u32

Encoding flags
Source§

fn sb_range(&self) -> OnigCodePoint

Single-byte range boundary
Source§

fn index(&self) -> i32

Encoding index
Source§

fn init(&self) -> i32

Initialize encoding (for callout registration etc.)
Source§

fn is_initialized(&self) -> bool

Is this encoding initialized?

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.