pub enum TypeSpec {
Any,
ContractRef(String),
Str,
Int,
Num,
Bool,
Array(Box<TypeSpec>),
Enum(Vec<String>),
}Expand description
契约中的字段类型
Variants§
Any
任意类型
ContractRef(String)
引用另一个契约(组合)——字段值须是块,并递归按被引用契约校验。 用组合而非继承:契约之间不共享字段,而是「字段的类型是另一个契约」。 语法上复用裸词(写被引用的契约名),因此不引入任何新 token: @contract Address { city: str } @contract Server { address: Address }
Str
Int
Num
数值:int 或 float 均可
Bool
Array(Box<TypeSpec>)
数组,元素须为指定类型
Enum(Vec<String>)
枚举:取值须在给定列表中
Trait Implementations§
impl StructuralPartialEq for TypeSpec
Auto Trait Implementations§
impl Freeze for TypeSpec
impl RefUnwindSafe for TypeSpec
impl Send for TypeSpec
impl Sync for TypeSpec
impl Unpin for TypeSpec
impl UnsafeUnpin for TypeSpec
impl UnwindSafe for TypeSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more