#[derive(Mock)]
{
// Attributes available to this derive:
#[mock]
}
Expand description
Derives the Mock
trait for a type, allowing to use it as a state for mocking.
Container attributes
Container attributes are placed in a #[mock(...)]
attribute on a struct / enum.
shared
Signals to use the Shared
wrapper for the mock state; by default,
the ThreadLocal
wrapper is used. Can be specified as #[mock(shared)]
or
#[mock(shared = true)]
.
mut
Signals to use the Mut
wrapper for the mock state. With this flag set, mock methods
will receive &Mut<Self>
as the first arg instead of &self
.
Examples
See ThreadLocal
and Shared
docs for examples of usage.