pub trait MoveShape {
const NAME: &'static str;
fn move_shape() -> Shape;
}
impl MoveShape for iota_types::ObjectId {
const NAME: &'static str = "ObjectId";
fn move_shape() -> Shape {
Shape::Address
}
}
impl MoveShape for iota_types::Address {
const NAME: &'static str = "Address";
fn move_shape() -> Shape {
Shape::Address
}
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum Shape {
Bool,
U8,
U16,
U32,
U64,
U128,
Address,
Vector(Box<Shape>),
Option(Box<Shape>),
Struct {
fields: Vec<Field>,
},
Datatype {
name: &'static str,
args: Vec<Shape>,
},
TypeParameter(u16),
Phantom,
Enum {
variants: Vec<Variant>,
},
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct Field {
pub name: &'static str,
pub shape: Shape,
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct Variant {
pub name: &'static str,
pub fields: Vec<Field>,
}