pub struct Expectation {
common: Common,
rfunc: Mutex<Rfunc>,
}
Expand description
Expectation type for methods that return a 'static
type.
This is the type returned by the expect_*
methods.
Fields§
§common: Common
§rfunc: Mutex<Rfunc>
Implementations§
Source§impl Expectation
impl Expectation
Sourcepub fn return_const<MockallOutput>(
&mut self,
__mockall_c: MockallOutput,
) -> &mut Self
pub fn return_const<MockallOutput>( &mut self, __mockall_c: MockallOutput, ) -> &mut Self
Return a constant value from the Expectation
The output type must be Clone
. The compiler can’t always
infer the proper type to use with this method; you will
usually need to specify it explicitly. i.e.
return_const(42i32)
instead of return_const(42)
.
Sourcepub fn return_const_st<MockallOutput>(
&mut self,
__mockall_c: MockallOutput,
) -> &mut Self
pub fn return_const_st<MockallOutput>( &mut self, __mockall_c: MockallOutput, ) -> &mut Self
Single-threaded version of
return_const
. This is useful for
return types that are not Send
.
The output type must be Clone
. The compiler can’t always
infer the proper type to use with this method; you will
usually need to specify it explicitly. i.e.
return_const(42i32)
instead of return_const(42)
.
It is a runtime error to call the mock method from a different thread than the one that originally called this method.
Sourcepub fn return_once<MockallF>(&mut self, __mockall_f: MockallF) -> &mut Selfwhere
MockallF: for<'a> FnOnce(&'a str, Option<Uuid>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<ProviderStatusType>, Option<bool>, Option<ProviderType>, Option<bool>, Option<String>, Option<String>, Option<GatewayType>, Option<&'a str>, Option<&'a str>, Option<&'a str>) -> Result<(), Error<GetCreditError>> + Send + 'static,
pub fn return_once<MockallF>(&mut self, __mockall_f: MockallF) -> &mut Selfwhere
MockallF: for<'a> FnOnce(&'a str, Option<Uuid>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<ProviderStatusType>, Option<bool>, Option<ProviderType>, Option<bool>, Option<String>, Option<String>, Option<GatewayType>, Option<&'a str>, Option<&'a str>, Option<&'a str>) -> Result<(), Error<GetCreditError>> + Send + 'static,
Supply an FnOnce
closure that will provide the return
value for this Expectation. This is useful for return types
that aren’t Clone
. It will be an error to call this
method multiple times.
Sourcepub fn return_once_st<MockallF>(&mut self, __mockall_f: MockallF) -> &mut Selfwhere
MockallF: for<'a> FnOnce(&'a str, Option<Uuid>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<ProviderStatusType>, Option<bool>, Option<ProviderType>, Option<bool>, Option<String>, Option<String>, Option<GatewayType>, Option<&'a str>, Option<&'a str>, Option<&'a str>) -> Result<(), Error<GetCreditError>> + 'static,
pub fn return_once_st<MockallF>(&mut self, __mockall_f: MockallF) -> &mut Selfwhere
MockallF: for<'a> FnOnce(&'a str, Option<Uuid>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<ProviderStatusType>, Option<bool>, Option<ProviderType>, Option<bool>, Option<String>, Option<String>, Option<GatewayType>, Option<&'a str>, Option<&'a str>, Option<&'a str>) -> Result<(), Error<GetCreditError>> + 'static,
Single-threaded version of
return_once
. This is useful for
return types that are neither Send
nor Clone
.
It is a runtime error to call the mock method from a different thread than the one that originally called this method. It is also a runtime error to call the method more than once.
Sourcepub fn returning<MockallF>(&mut self, __mockall_f: MockallF) -> &mut Selfwhere
MockallF: for<'a> FnMut(&'a str, Option<Uuid>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<ProviderStatusType>, Option<bool>, Option<ProviderType>, Option<bool>, Option<String>, Option<String>, Option<GatewayType>, Option<&'a str>, Option<&'a str>, Option<&'a str>) -> Result<(), Error<GetCreditError>> + Send + 'static,
pub fn returning<MockallF>(&mut self, __mockall_f: MockallF) -> &mut Selfwhere
MockallF: for<'a> FnMut(&'a str, Option<Uuid>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<ProviderStatusType>, Option<bool>, Option<ProviderType>, Option<bool>, Option<String>, Option<String>, Option<GatewayType>, Option<&'a str>, Option<&'a str>, Option<&'a str>) -> Result<(), Error<GetCreditError>> + Send + 'static,
Supply a closure that will provide the return value for this
Expectation
. The method’s arguments are passed to the
closure by value.
Sourcepub fn returning_st<MockallF>(&mut self, __mockall_f: MockallF) -> &mut Selfwhere
MockallF: for<'a> FnMut(&'a str, Option<Uuid>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<ProviderStatusType>, Option<bool>, Option<ProviderType>, Option<bool>, Option<String>, Option<String>, Option<GatewayType>, Option<&'a str>, Option<&'a str>, Option<&'a str>) -> Result<(), Error<GetCreditError>> + 'static,
pub fn returning_st<MockallF>(&mut self, __mockall_f: MockallF) -> &mut Selfwhere
MockallF: for<'a> FnMut(&'a str, Option<Uuid>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<&'a str>, Option<ProviderStatusType>, Option<bool>, Option<ProviderType>, Option<bool>, Option<String>, Option<String>, Option<GatewayType>, Option<&'a str>, Option<&'a str>, Option<&'a str>) -> Result<(), Error<GetCreditError>> + 'static,
Single-threaded version of returning
.
Can be used when the argument or return type isn’t Send
.
It is a runtime error to call the mock method from a different thread than the one that originally called this method.
Sourcepub fn in_sequence(&mut self, __mockall_seq: &mut Sequence) -> &mut Self
pub fn in_sequence(&mut self, __mockall_seq: &mut Sequence) -> &mut Self
Add this expectation to a
Sequence
.
fn is_done(&self) -> bool
Sourcefn matches<'a>(
&self,
provider_id: &str,
id: &Option<Uuid>,
name: &Option<&'a str>,
business_name: &Option<&'a str>,
business_address1: &Option<&'a str>,
business_address2: &Option<&'a str>,
business_address3: &Option<&'a str>,
business_country: &Option<&'a str>,
business_tax_number: &Option<&'a str>,
billing_email: &Option<&'a str>,
billing_phone: &Option<&'a str>,
status: &Option<ProviderStatusType>,
use_events: &Option<bool>,
type: &Option<ProviderType>,
enabled: &Option<bool>,
creation_date: &Option<String>,
revision_date: &Option<String>,
gateway: &Option<GatewayType>,
gateway_customer_id: &Option<&'a str>,
gateway_subscription_id: &Option<&'a str>,
discount_id: &Option<&'a str>,
) -> bool
fn matches<'a>( &self, provider_id: &str, id: &Option<Uuid>, name: &Option<&'a str>, business_name: &Option<&'a str>, business_address1: &Option<&'a str>, business_address2: &Option<&'a str>, business_address3: &Option<&'a str>, business_country: &Option<&'a str>, business_tax_number: &Option<&'a str>, billing_email: &Option<&'a str>, billing_phone: &Option<&'a str>, status: &Option<ProviderStatusType>, use_events: &Option<bool>, type: &Option<ProviderType>, enabled: &Option<bool>, creation_date: &Option<String>, revision_date: &Option<String>, gateway: &Option<GatewayType>, gateway_customer_id: &Option<&'a str>, gateway_subscription_id: &Option<&'a str>, discount_id: &Option<&'a str>, ) -> bool
Validate this expectation’s matcher.
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new, default, Expectation
Sourcepub fn once(&mut self) -> &mut Self
pub fn once(&mut self) -> &mut Self
Expect this expectation to be called exactly once. Shortcut for
times(1)
.
Sourcepub fn times<MockallR>(&mut self, __mockall_r: MockallR) -> &mut Selfwhere
MockallR: Into<TimesRange>,
pub fn times<MockallR>(&mut self, __mockall_r: MockallR) -> &mut Selfwhere
MockallR: Into<TimesRange>,
Restrict the number of times that that this method may be called.
The argument may be:
- A fixed number:
.times(4)
- Various types of range:
.times(5..10)
.times(..10)
.times(5..)
.times(5..=10)
.times(..=10)
- The wildcard:
.times(..)
Sourcepub fn with<MockallMatcher0: for<'a> Predicate<str> + Send + 'static, MockallMatcher1: for<'a> Predicate<Option<Uuid>> + Send + 'static, MockallMatcher2: for<'a> Predicate<Option<&'a str>> + Send + 'static, MockallMatcher3: for<'a> Predicate<Option<&'a str>> + Send + 'static, MockallMatcher4: for<'a> Predicate<Option<&'a str>> + Send + 'static, MockallMatcher5: for<'a> Predicate<Option<&'a str>> + Send + 'static, MockallMatcher6: for<'a> Predicate<Option<&'a str>> + Send + 'static, MockallMatcher7: for<'a> Predicate<Option<&'a str>> + Send + 'static, MockallMatcher8: for<'a> Predicate<Option<&'a str>> + Send + 'static, MockallMatcher9: for<'a> Predicate<Option<&'a str>> + Send + 'static, MockallMatcher10: for<'a> Predicate<Option<&'a str>> + Send + 'static, MockallMatcher11: for<'a> Predicate<Option<ProviderStatusType>> + Send + 'static, MockallMatcher12: for<'a> Predicate<Option<bool>> + Send + 'static, MockallMatcher13: for<'a> Predicate<Option<ProviderType>> + Send + 'static, MockallMatcher14: for<'a> Predicate<Option<bool>> + Send + 'static, MockallMatcher15: for<'a> Predicate<Option<String>> + Send + 'static, MockallMatcher16: for<'a> Predicate<Option<String>> + Send + 'static, MockallMatcher17: for<'a> Predicate<Option<GatewayType>> + Send + 'static, MockallMatcher18: for<'a> Predicate<Option<&'a str>> + Send + 'static, MockallMatcher19: for<'a> Predicate<Option<&'a str>> + Send + 'static, MockallMatcher20: for<'a> Predicate<Option<&'a str>> + Send + 'static>(
&mut self,
provider_id: MockallMatcher0,
id: MockallMatcher1,
name: MockallMatcher2,
business_name: MockallMatcher3,
business_address1: MockallMatcher4,
business_address2: MockallMatcher5,
business_address3: MockallMatcher6,
business_country: MockallMatcher7,
business_tax_number: MockallMatcher8,
billing_email: MockallMatcher9,
billing_phone: MockallMatcher10,
status: MockallMatcher11,
use_events: MockallMatcher12,
type: MockallMatcher13,
enabled: MockallMatcher14,
creation_date: MockallMatcher15,
revision_date: MockallMatcher16,
gateway: MockallMatcher17,
gateway_customer_id: MockallMatcher18,
gateway_subscription_id: MockallMatcher19,
discount_id: MockallMatcher20,
) -> &mut Self
pub fn with<MockallMatcher0: for<'a> Predicate<str> + Send + 'static, MockallMatcher1: for<'a> Predicate<Option<Uuid>> + Send + 'static, MockallMatcher2: for<'a> Predicate<Option<&'a str>> + Send + 'static, MockallMatcher3: for<'a> Predicate<Option<&'a str>> + Send + 'static, MockallMatcher4: for<'a> Predicate<Option<&'a str>> + Send + 'static, MockallMatcher5: for<'a> Predicate<Option<&'a str>> + Send + 'static, MockallMatcher6: for<'a> Predicate<Option<&'a str>> + Send + 'static, MockallMatcher7: for<'a> Predicate<Option<&'a str>> + Send + 'static, MockallMatcher8: for<'a> Predicate<Option<&'a str>> + Send + 'static, MockallMatcher9: for<'a> Predicate<Option<&'a str>> + Send + 'static, MockallMatcher10: for<'a> Predicate<Option<&'a str>> + Send + 'static, MockallMatcher11: for<'a> Predicate<Option<ProviderStatusType>> + Send + 'static, MockallMatcher12: for<'a> Predicate<Option<bool>> + Send + 'static, MockallMatcher13: for<'a> Predicate<Option<ProviderType>> + Send + 'static, MockallMatcher14: for<'a> Predicate<Option<bool>> + Send + 'static, MockallMatcher15: for<'a> Predicate<Option<String>> + Send + 'static, MockallMatcher16: for<'a> Predicate<Option<String>> + Send + 'static, MockallMatcher17: for<'a> Predicate<Option<GatewayType>> + Send + 'static, MockallMatcher18: for<'a> Predicate<Option<&'a str>> + Send + 'static, MockallMatcher19: for<'a> Predicate<Option<&'a str>> + Send + 'static, MockallMatcher20: for<'a> Predicate<Option<&'a str>> + Send + 'static>( &mut self, provider_id: MockallMatcher0, id: MockallMatcher1, name: MockallMatcher2, business_name: MockallMatcher3, business_address1: MockallMatcher4, business_address2: MockallMatcher5, business_address3: MockallMatcher6, business_country: MockallMatcher7, business_tax_number: MockallMatcher8, billing_email: MockallMatcher9, billing_phone: MockallMatcher10, status: MockallMatcher11, use_events: MockallMatcher12, type: MockallMatcher13, enabled: MockallMatcher14, creation_date: MockallMatcher15, revision_date: MockallMatcher16, gateway: MockallMatcher17, gateway_customer_id: MockallMatcher18, gateway_subscription_id: MockallMatcher19, discount_id: MockallMatcher20, ) -> &mut Self
Set matching criteria for this Expectation.
The matching predicate can be anything implemening the
Predicate
trait. Only
one matcher can be set per Expectation
at a time.
Sourcepub fn withf<MockallF>(&mut self, __mockall_f: MockallF) -> &mut Selfwhere
MockallF: for<'a> Fn(&str, &Option<Uuid>, &Option<&'a str>, &Option<&'a str>, &Option<&'a str>, &Option<&'a str>, &Option<&'a str>, &Option<&'a str>, &Option<&'a str>, &Option<&'a str>, &Option<&'a str>, &Option<ProviderStatusType>, &Option<bool>, &Option<ProviderType>, &Option<bool>, &Option<String>, &Option<String>, &Option<GatewayType>, &Option<&'a str>, &Option<&'a str>, &Option<&'a str>) -> bool + Send + 'static,
pub fn withf<MockallF>(&mut self, __mockall_f: MockallF) -> &mut Selfwhere
MockallF: for<'a> Fn(&str, &Option<Uuid>, &Option<&'a str>, &Option<&'a str>, &Option<&'a str>, &Option<&'a str>, &Option<&'a str>, &Option<&'a str>, &Option<&'a str>, &Option<&'a str>, &Option<&'a str>, &Option<ProviderStatusType>, &Option<bool>, &Option<ProviderType>, &Option<bool>, &Option<String>, &Option<String>, &Option<GatewayType>, &Option<&'a str>, &Option<&'a str>, &Option<&'a str>) -> bool + Send + 'static,
Set a matching function for this Expectation.
This is equivalent to calling with
with a
function argument, like with(predicate::function(f))
.
Sourcepub fn withf_st<MockallF>(&mut self, __mockall_f: MockallF) -> &mut Selfwhere
MockallF: for<'a> Fn(&str, &Option<Uuid>, &Option<&'a str>, &Option<&'a str>, &Option<&'a str>, &Option<&'a str>, &Option<&'a str>, &Option<&'a str>, &Option<&'a str>, &Option<&'a str>, &Option<&'a str>, &Option<ProviderStatusType>, &Option<bool>, &Option<ProviderType>, &Option<bool>, &Option<String>, &Option<String>, &Option<GatewayType>, &Option<&'a str>, &Option<&'a str>, &Option<&'a str>) -> bool + 'static,
pub fn withf_st<MockallF>(&mut self, __mockall_f: MockallF) -> &mut Selfwhere
MockallF: for<'a> Fn(&str, &Option<Uuid>, &Option<&'a str>, &Option<&'a str>, &Option<&'a str>, &Option<&'a str>, &Option<&'a str>, &Option<&'a str>, &Option<&'a str>, &Option<&'a str>, &Option<&'a str>, &Option<ProviderStatusType>, &Option<bool>, &Option<ProviderType>, &Option<bool>, &Option<String>, &Option<String>, &Option<GatewayType>, &Option<&'a str>, &Option<&'a str>, &Option<&'a str>) -> bool + 'static,
Single-threaded version of withf
.
Can be used when the argument type isn’t Send
.