Skip to main content

ByteArrayExtensions

Trait ByteArrayExtensions 

Source
pub trait ByteArrayExtensions {
    // Required methods
    fn sub_array(
        &self,
        start_index: usize,
        length: usize,
    ) -> Result<Vec<u8>, String>;
    fn to_hex_string(&self, separator: &str) -> String;
    fn to_base64_string(&self) -> String;
    fn to_utf8_string(&self) -> Result<String, String>;
    fn equals(&self, other: &[u8]) -> bool;
    fn get_hash_code(&self) -> u32;
}
Expand description

字节数组扩展方法

Required Methods§

Source

fn sub_array( &self, start_index: usize, length: usize, ) -> Result<Vec<u8>, String>

获取字节数组的子数组

Source

fn to_hex_string(&self, separator: &str) -> String

将字节数组转换为十六进制字符串

Source

fn to_base64_string(&self) -> String

将字节数组转换为Base64字符串

Source

fn to_utf8_string(&self) -> Result<String, String>

将字节数组转换为UTF8字符串

Source

fn equals(&self, other: &[u8]) -> bool

比较两个字节数组是否相等

Source

fn get_hash_code(&self) -> u32

计算字节数组的哈希值

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl ByteArrayExtensions for [u8]

Source§

fn sub_array( &self, start_index: usize, length: usize, ) -> Result<Vec<u8>, String>

Source§

fn to_hex_string(&self, separator: &str) -> String

Source§

fn to_base64_string(&self) -> String

Source§

fn to_utf8_string(&self) -> Result<String, String>

Source§

fn equals(&self, other: &[u8]) -> bool

Source§

fn get_hash_code(&self) -> u32

Implementors§