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§
Sourcefn sub_array(
&self,
start_index: usize,
length: usize,
) -> Result<Vec<u8>, String>
fn sub_array( &self, start_index: usize, length: usize, ) -> Result<Vec<u8>, String>
获取字节数组的子数组
Sourcefn to_hex_string(&self, separator: &str) -> String
fn to_hex_string(&self, separator: &str) -> String
将字节数组转换为十六进制字符串
Sourcefn to_base64_string(&self) -> String
fn to_base64_string(&self) -> String
将字节数组转换为Base64字符串
Sourcefn to_utf8_string(&self) -> Result<String, String>
fn to_utf8_string(&self) -> Result<String, String>
将字节数组转换为UTF8字符串
Sourcefn get_hash_code(&self) -> u32
fn get_hash_code(&self) -> u32
计算字节数组的哈希值
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".