pub trait Model: Sized {
const SCALAR_SIZE: u32 = 0;
// Required methods
unsafe fn to_model(self) -> Obj;
unsafe fn from_model(o: Obj) -> Self;
// Provided methods
unsafe fn set_scalar(self, o: Obj, off: u32) { ... }
unsafe fn get_scalar(o: Obj, off: u32) -> Self { ... }
}Expand description
A Rust value in the representation of its type in Aeneas’s model.
Provided Associated Constants§
Sourceconst SCALAR_SIZE: u32 = 0
const SCALAR_SIZE: u32 = 0
Size of the value as a scalar field of a constructor, or 0 when it is an object field.
Required Methods§
Sourceunsafe fn to_model(self) -> Obj
unsafe fn to_model(self) -> Obj
The owned boxed object of self.
§Safety
The result is an owned Lean object that must be released with lean_dec or passed on.
Sourceunsafe fn from_model(o: Obj) -> Self
unsafe fn from_model(o: Obj) -> Self
The Rust value of the borrowed boxed object o.
§Safety
o must be a valid Lean value of the model type of Self.
Provided Methods§
Sourceunsafe fn set_scalar(self, o: Obj, off: u32)
unsafe fn set_scalar(self, o: Obj, off: u32)
Writes self as a scalar field at byte offset off of the constructor o.
§Safety
o must be a constructor with a scalar area holding the field at off.
Sourceunsafe fn get_scalar(o: Obj, off: u32) -> Self
unsafe fn get_scalar(o: Obj, off: u32) -> Self
Reads a scalar field at byte offset off of the constructor o.
§Safety
o must be a constructor with a scalar area holding the field at off.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl Model for &'static str
A &'static str read back from the model is leaked: tests compare the few values a model
returns, and a field such as Other(&'static str) has no owner to borrow from.
impl Model for &'static str
A &'static str read back from the model is leaked: tests compare the few values a model
returns, and a field such as Other(&'static str) has no owner to borrow from.