pub struct Contract {
pub name: String,
pub fields: BTreeMap<String, FieldSpec>,
pub allow_extra: bool,
}Expand description
契约(schema):一组字段规格
Fields§
§name: String§fields: BTreeMap<String, FieldSpec>§allow_extra: bool是否允许契约未声明的字段。
默认 false(严格):额外字段一律报错,可及早发现拼写错误
(如 prot 误写为 port)。确需放宽时须显式写 loose。
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Contract
impl RefUnwindSafe for Contract
impl Send for Contract
impl Sync for Contract
impl Unpin for Contract
impl UnsafeUnpin for Contract
impl UnwindSafe for Contract
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