pub struct Expectation { /* private fields */ }
Expand description

Expectation type for methods that return a 'static type. This is the type returned by the expect_* methods.

Implementations§

source§

impl Expectation

source

pub fn return_const<MockallOutput>( &mut self, __mockall_c: MockallOutput ) -> &mut Expectationwhere MockallOutput: Clone + Into<Result<MustBoxFuture<'static, Result<(), KitsuneP2pError>>, KitsuneP2pError>> + Send + 'static,

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).

source

pub fn return_const_st<MockallOutput>( &mut self, __mockall_c: MockallOutput ) -> &mut Expectationwhere MockallOutput: Clone + Into<Result<MustBoxFuture<'static, Result<(), KitsuneP2pError>>, KitsuneP2pError>> + 'static,

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.

source

pub fn return_once<MockallF>( &mut self, __mockall_f: MockallF ) -> &mut Expectationwhere MockallF: FnOnce(Arc<KitsuneSpace>, Vec<Arc<KitsuneAgent>, Global>, KitsuneTimeout, Vec<u8, Global>, bool) -> Result<MustBoxFuture<'static, Result<(), KitsuneP2pError>>, KitsuneP2pError> + 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.

source

pub fn return_once_st<MockallF>( &mut self, __mockall_f: MockallF ) -> &mut Expectationwhere MockallF: FnOnce(Arc<KitsuneSpace>, Vec<Arc<KitsuneAgent>, Global>, KitsuneTimeout, Vec<u8, Global>, bool) -> Result<MustBoxFuture<'static, Result<(), KitsuneP2pError>>, KitsuneP2pError> + '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.

source

pub fn returning<MockallF>(&mut self, __mockall_f: MockallF) -> &mut Expectationwhere MockallF: FnMut(Arc<KitsuneSpace>, Vec<Arc<KitsuneAgent>, Global>, KitsuneTimeout, Vec<u8, Global>, bool) -> Result<MustBoxFuture<'static, Result<(), KitsuneP2pError>>, KitsuneP2pError> + 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.

source

pub fn returning_st<MockallF>( &mut self, __mockall_f: MockallF ) -> &mut Expectationwhere MockallF: FnMut(Arc<KitsuneSpace>, Vec<Arc<KitsuneAgent>, Global>, KitsuneTimeout, Vec<u8, Global>, bool) -> Result<MustBoxFuture<'static, Result<(), KitsuneP2pError>>, KitsuneP2pError> + '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.

source

pub fn in_sequence(&mut self, __mockall_seq: &mut Sequence) -> &mut Expectation

Add this expectation to a Sequence.

source

pub fn never(&mut self) -> &mut Expectation

Forbid this expectation from ever being called.

source

pub fn new() -> Expectation

Create a new, default, Expectation

source

pub fn once(&mut self) -> &mut Expectation

Expect this expectation to be called exactly once. Shortcut for times(1).

source

pub fn times<MockallR>(&mut self, __mockall_r: MockallR) -> &mut Expectationwhere 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(..)
source

pub fn with<MockallMatcher0, MockallMatcher1, MockallMatcher2, MockallMatcher3, MockallMatcher4>( &mut self, space: MockallMatcher0, agents: MockallMatcher1, timeout: MockallMatcher2, payload: MockallMatcher3, drop_at_limit: MockallMatcher4 ) -> &mut Expectationwhere MockallMatcher0: Predicate<Arc<KitsuneSpace>> + Send + 'static, MockallMatcher1: Predicate<Vec<Arc<KitsuneAgent>, Global>> + Send + 'static, MockallMatcher2: Predicate<KitsuneTimeout> + Send + 'static, MockallMatcher3: Predicate<Vec<u8, Global>> + Send + 'static, MockallMatcher4: Predicate<bool> + Send + 'static,

Set matching crieteria for this Expectation.

The matching predicate can be anything implemening the Predicate trait. Only one matcher can be set per Expectation at a time.

source

pub fn withf<MockallF>(&mut self, __mockall_f: MockallF) -> &mut Expectationwhere MockallF: Fn(&Arc<KitsuneSpace>, &Vec<Arc<KitsuneAgent>, Global>, &KitsuneTimeout, &Vec<u8, Global>, &bool) -> 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)).

source

pub fn withf_st<MockallF>(&mut self, __mockall_f: MockallF) -> &mut Expectationwhere MockallF: Fn(&Arc<KitsuneSpace>, &Vec<Arc<KitsuneAgent>, Global>, &KitsuneTimeout, &Vec<u8, Global>, &bool) -> bool + 'static,

Single-threaded version of withf. Can be used when the argument type isn’t Send.

Trait Implementations§

source§

impl Default for Expectation

source§

fn default() -> Expectation

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Any for Twhere T: Any + ?Sized,

§

fn type_id_compat(&self) -> TypeId

TODO: once 1.33.0 is the minimum supported compiler version, remove Any::type_id_compat and use StdAny::type_id instead. https://github.com/rust-lang/rust/issues/27745
§

impl<T> ArchivePointee for T

§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

§

fn deserialize( &self, deserializer: &mut D ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Pointee for T

§

type Metadata = ()

The type for metadata in pointers and references to Self.
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcastable for Twhere T: Any + Send + Sync + 'static,

§

fn upcast_any_ref(&self) -> &(dyn Any + 'static)

upcast ref
§

fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)

upcast mut ref
§

fn upcast_any_box(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>

upcast boxed dyn
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more