1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use crate::ffi::{buf::AscTypedArray, sys};
pub fn hex(bytes: impl AsRef<[u8]>) -> String {
let bytes = AscTypedArray::from_bytes(bytes.as_ref());
let str = unsafe { &*sys::type_conversion__bytes_to_hex(bytes.as_ptr()) };
str.to_string_lossy()
}
pub fn base58(bytes: impl AsRef<[u8]>) -> String {
let bytes = AscTypedArray::from_bytes(bytes.as_ref());
let str = unsafe { &*sys::type_conversion__bytes_to_base58(bytes.as_ptr()) };
str.to_string_lossy()
}
#[deprecated]
pub fn string(bytes: impl AsRef<[u8]>) -> String {
let bytes = AscTypedArray::from_bytes(bytes.as_ref());
let str = unsafe { &*sys::type_conversion__bytes_to_string(bytes.as_ptr()) };
str.to_string_lossy()
}