pub struct Match<'p, F: MockFn, O: Ordering> { /* private fields */ }
Expand description

A matched call pattern, ready for setting up a response.

Implementations

Specify the output of the call pattern by providing a value. The output type must implement Clone and cannot contain non-static references. It must also be Send and Sync because unimock needs to store it.

Specify the output of the call pattern by calling Default::default().

Specify the output of the call to be a borrow of the provided value. This works well when the lifetime of the returned reference is the same as self. Using this for 'static references will produce a runtime error. For static references, use Match::returns_static.

Specify the output of the call to be a reference to static value. This must be used when the returned reference in the mocked trait is 'static.

Specify the output of the call pattern by invoking the given closure that can then compute it based on input parameters.

Specify the output of the call pattern to be a static reference to leaked memory.

The value may be based on the value of input parameters.

This version will produce a new memory leak for every invocation of the answer function.

This method should only be used when computing a reference based on input parameters is necessary, which should not be a common use case.

Prevent this call pattern from succeeding by explicitly panicking with a custom message.

Instruct this call pattern to invoke the Unmocked function.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.