Skip to main content

Model

Trait Model 

Source
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§

Source

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§

Source

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.

Source

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§

Source

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.

Source

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.

Source§

unsafe fn to_model(self) -> Obj

Source§

unsafe fn from_model(o: Obj) -> Self

Source§

impl Model for ()

Source§

unsafe fn to_model(self) -> Obj

Source§

unsafe fn from_model(_o: Obj) -> Self

Source§

impl Model for String

Source§

unsafe fn to_model(self) -> Obj

Source§

unsafe fn from_model(o: Obj) -> Self

Source§

impl Model for bool

Source§

const SCALAR_SIZE: u32 = 1

Source§

unsafe fn to_model(self) -> Obj

Source§

unsafe fn from_model(o: Obj) -> Self

Source§

unsafe fn set_scalar(self, o: Obj, off: u32)

Source§

unsafe fn get_scalar(o: Obj, off: u32) -> Self

Source§

impl Model for char

Source§

const SCALAR_SIZE: u32 = 4

Source§

unsafe fn to_model(self) -> Obj

Source§

unsafe fn from_model(o: Obj) -> Self

Source§

unsafe fn set_scalar(self, o: Obj, off: u32)

Source§

unsafe fn get_scalar(o: Obj, off: u32) -> Self

Source§

impl Model for i8

Source§

unsafe fn to_model(self) -> Obj

Source§

unsafe fn from_model(o: Obj) -> Self

Source§

impl Model for i16

Source§

unsafe fn to_model(self) -> Obj

Source§

unsafe fn from_model(o: Obj) -> Self

Source§

impl Model for i32

Source§

unsafe fn to_model(self) -> Obj

Source§

unsafe fn from_model(o: Obj) -> Self

Source§

impl Model for i64

Source§

unsafe fn to_model(self) -> Obj

Source§

unsafe fn from_model(o: Obj) -> Self

Source§

impl Model for i128

Source§

unsafe fn to_model(self) -> Obj

Source§

unsafe fn from_model(o: Obj) -> Self

Source§

impl Model for isize

Source§

unsafe fn to_model(self) -> Obj

Source§

unsafe fn from_model(o: Obj) -> Self

Source§

impl Model for u8

Source§

unsafe fn to_model(self) -> Obj

Source§

unsafe fn from_model(o: Obj) -> Self

Source§

impl Model for u16

Source§

unsafe fn to_model(self) -> Obj

Source§

unsafe fn from_model(o: Obj) -> Self

Source§

impl Model for u32

Source§

unsafe fn to_model(self) -> Obj

Source§

unsafe fn from_model(o: Obj) -> Self

Source§

impl Model for u64

Source§

unsafe fn to_model(self) -> Obj

Source§

unsafe fn from_model(o: Obj) -> Self

Source§

impl Model for u128

Source§

unsafe fn to_model(self) -> Obj

Source§

unsafe fn from_model(o: Obj) -> Self

Source§

impl Model for usize

Source§

unsafe fn to_model(self) -> Obj

Source§

unsafe fn from_model(o: Obj) -> Self

Source§

impl<A: Model, B: Model, C: Model, D: Model> Model for (A, B, C, D)

Source§

unsafe fn to_model(self) -> Obj

Source§

unsafe fn from_model(o: Obj) -> Self

Source§

impl<A: Model, B: Model, C: Model> Model for (A, B, C)

Source§

unsafe fn to_model(self) -> Obj

Source§

unsafe fn from_model(o: Obj) -> Self

Source§

impl<A: Model, B: Model> Model for (A, B)

Source§

unsafe fn to_model(self) -> Obj

Source§

unsafe fn from_model(o: Obj) -> Self

Source§

impl<T: Model, const N: usize> Model for [T; N]

Source§

unsafe fn to_model(self) -> Obj

Source§

unsafe fn from_model(o: Obj) -> Self

Source§

impl<T: Model> Model for Box<T>

Source§

unsafe fn to_model(self) -> Obj

Source§

unsafe fn from_model(o: Obj) -> Self

Source§

impl<T: Model> Model for Option<T>

Source§

unsafe fn to_model(self) -> Obj

Source§

unsafe fn from_model(o: Obj) -> Self

Source§

impl<T: Model> Model for Vec<T>

Source§

unsafe fn to_model(self) -> Obj

Source§

unsafe fn from_model(o: Obj) -> Self

Implementors§