Skip to main content

StrSliceExecFns

Trait StrSliceExecFns 

pub trait StrSliceExecFns {
    // Required methods
    fn unicode_len(&self) -> usize;
    fn get_char(&self, i: usize) -> char;
    fn substring_ascii<'a>(&'a self, from: usize, to: usize) -> &'a str;
    fn substring_char<'a>(&'a self, from: usize, to: usize) -> &'a str;
    fn get_ascii(&self, i: usize) -> u8;
    fn as_bytes_vec(&self) -> Vec<u8> ⓘ;
}

Required Methods§

fn unicode_len(&self) -> usize

fn get_char(&self, i: usize) -> char

fn substring_ascii<'a>(&'a self, from: usize, to: usize) -> &'a str

fn substring_char<'a>(&'a self, from: usize, to: usize) -> &'a str

fn get_ascii(&self, i: usize) -> u8

fn as_bytes_vec(&self) -> Vec<u8> ⓘ

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

§

impl StrSliceExecFns for str

Available on non-verus_verify_core only.
§

fn unicode_len(&self) -> usize

The len() function in rust returns the byte length. It is more useful to talk about the length of characters and therefore this function was added. Please note that this function counts the unicode variation selectors as characters. Warning: O(n)

§

fn get_char(&self, i: usize) -> char

Warning: O(n) not O(1) due to unicode decoding needed

§

fn substring_ascii<'a>(&'a self, from: usize, to: usize) -> &'a str

§

fn substring_char<'a>(&'a self, from: usize, to: usize) -> &'a str

§

fn get_ascii(&self, i: usize) -> u8

§

fn as_bytes_vec(&self) -> Vec<u8> ⓘ

Implementors§