Attribute Macro mocktopus_macros::not_mockable[][src]

#[not_mockable]

Procedural macro, guards items from being made mockable by enclosing item.

Valid to annotate

  • module definitions
#[mockable]
mod module {
    #[not_mockable]
    mod nested {
        fn not_mockable() { ... }
    }
}
  • standalone functions
#[mockable]
mod module {
    #[not_mockable]
    fn not_mockable() { ... }
}
  • struct impl blocks
#[mockable]
mod module {
    #[not_mockable]
    impl Struct {
        fn not_mockable() { ... }
    }
}
  • trait impl blocks
#[mockable]
mod module {
    #[not_mockable]
    impl Trait for Struct {
        fn not_mockable() { ... }
    }
}
  • traits
#[mockable]
mod module {
    #[not_mockable]
    trait Trait {
        fn not_mockable() { ... }
    }
}
  • single functions in struct impls
#[mockable]
impl Struct {
    #[not_mockable]
    fn not_mockable() { ... }
}
  • single functions in trait impls
#[mockable]
impl Trait for Struct {
    #[not_mockable]
    fn not_mockable() { ... }
}
  • single default functions in traits
#[mockable]
trait Trait {
    #[not_mockable]
    fn not_mockable() { ... }
}

Indifferent to annotate

  • items not made mockable by enclosing item
  • any other items