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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
use core::str::from_utf8;
use crate::{
abi::{AbiReader, AbiWriter, Result},
custom_signature::SignatureUnit,
};
pub trait AbiType {
const SIGNATURE: SignatureUnit;
#[must_use]
fn as_str() -> &'static str {
from_utf8(&Self::SIGNATURE.data[..Self::SIGNATURE.len]).expect("bad utf-8")
}
fn is_dynamic() -> bool;
fn size() -> usize;
}
pub trait AbiRead {
fn abi_read(reader: &mut AbiReader) -> Result<Self>
where
Self: Sized;
}
pub trait AbiWrite {
fn abi_write(&self, writer: &mut AbiWriter);
}