[go: up one dir, main page]

mockall 0.3.0

A powerful mock object library for Rust.
Documentation
// vim: tw=80
//! methods can use non-public types, as long as the object's visibility is
//! compatible.

use mockall::*;

#[allow(unused)]
mod outer {
    struct SuperT();

    mod inner {
        use super::super::mock;

        pub(crate) struct PubCrateT();
        struct PrivT();

        mock! {
            Foo {
                fn foo(&self, x: PubCrateT) -> PubCrateT;
                fn bar(&self, x: PrivT) -> PrivT;
                fn baz(&self, x: super::SuperT) -> super::SuperT;
                fn refbaz(&self, x: super::SuperT) -> &super::SuperT;
                fn refmutbaz(&mut self, x: super::SuperT) -> &mut super::SuperT;
                fn staticbaz(x: super::SuperT) -> super::SuperT;
                fn bang(&self, x: crate::outer::SuperT) -> crate::outer::SuperT;
                fn bean(&self, x: self::PrivT) -> self::PrivT;
            }
        }
    }
}