Skip to main content

Config

Struct Config 

Source
pub struct Config {
    pub embed_spec: bool,
    pub emit_print: bool,
    pub emit_panic: bool,
}

Fields§

§embed_spec: bool§emit_print: bool§emit_panic: bool

Implementations§

Source§

impl Config

Source

pub fn instrument_item_struct( &self, spec: DataSpec, item_struct: ItemStruct, ) -> Result<TokenStream>

Source

pub fn instrument_item_enum( &self, spec: DataSpec, item_enum: ItemEnum, ) -> Result<TokenStream>

Source§

impl Config

Source

pub fn instrument_fn( &self, spec: &Spec, sig: &Signature, body: &mut Block, ) -> Result<()>

Source

pub fn build_spec_fn_sig(prefix: &str, sig: &Signature) -> Signature

Source

pub fn build_qualifier_const_item<SomeConstItem: Parse>( attrs: &[Attribute], prefix: &str, qualifiers: FnQualifiers, fn_ident: &Ident, ) -> SomeConstItem

Source

pub fn build_qualifier_check_stmt( fn_ident: &Ident, impl_type: &Type, trait_path: &Path, ) -> Stmt

Source

pub fn build_precondition_fn_body(conditions: &[PreCondition]) -> Block

Source

pub fn build_poscondition_fn_body( captures: &[Capture], conditions: &[PostCondition], return_type: &ReturnType, ) -> Result<Block>

Source§

impl Config

Source

pub fn instrument_loops_in_fn_body(&self, body: &mut Block) -> Result<()>

Source

pub fn instrument_expr_while(&self, spec: LoopSpec, expr_while: &mut ExprWhile)

Source

pub fn instrument_expr_for_loop( &self, spec: LoopSpec, expr_for_loop: &mut ExprForLoop, )

Source§

impl Config

Source

pub fn instrument_trait( &self, spec: DataSpec, the_trait: ItemTrait, ) -> Result<ItemTrait>

Expand trait items by mangling each method and adding a wrapper default impl.

Mangling a function involves the following:

  1. Rename the function following the pattern: fn add -> fn __anodized_add.
  2. Make a new function with the original name that has a default impl; the default impl performs runtime validation and calls the mangled function.
Source

pub fn instrument_trait_impl( &self, spec: DataSpec, the_impl: ItemImpl, ) -> Result<ItemImpl>

Expand impl items by mangling methods for trait impls.

The #[spec] attribute on an impl fn must narrow the #[spec] of the trait fn:

  • The impl’s preconditions must follow from the trait’s preconditions.
  • The impl’s postconditions must entail the trait’s postconditions.
Source§

impl Config

Source

pub fn emit_anything(&self) -> bool

Source

pub fn instrument_item_fn( &self, spec: Spec, item_fn: ItemFn, ) -> Result<TokenStream>

Source

pub fn instrument_item_trait( &self, spec: DataSpec, item_trait: ItemTrait, ) -> Result<TokenStream>

Source

pub fn instrument_item_trait_impl( &self, spec: DataSpec, item_impl: ItemImpl, ) -> Result<TokenStream>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.