Skip to main content

Repr

Trait Repr 

Source
pub trait Repr<R: Sized>: Sized {
    // Required methods
    spec fn wf(r: R) -> bool;
    spec fn from_repr_spec(r: R) -> Self;
    exec fn to_repr(self) -> res : R;
    exec fn from_borrowed<'a>(r: &'a R) -> res : &'a Self;
    exec fn from_borrowed_mut<'a>(r: &'a mut R) -> res : &'a mut Self;
}
Expand description

A trait for types that have a concrete representation type R.

Required Methods§

Source

spec fn wf(r: R) -> bool

Source

spec fn from_repr_spec(r: R) -> Self

Source

exec fn to_repr(self) -> res : R

ensures
Self::wf(res),
Self::from_repr_spec(res) == self,
Source

exec fn from_borrowed<'a>(r: &'a R) -> res : &'a Self

requires
Self::wf(*r),
ensures
*res == Self::from_repr_spec(*r),
Source

exec fn from_borrowed_mut<'a>(r: &'a mut R) -> res : &'a mut Self

requires
Self::wf(*old(r)),
ensures
*res == Self::from_repr_spec(*old(r)),
Self::wf(*final(r)),
*final(res) == Self::from_repr_spec(*final(r)),

Mutable projection of the representation. Implementations must keep the representation consistent with mutations through the returned reference.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§