Struct FunnyBot

Source
pub struct FunnyBot<'a, A, R>
where A: Send + Sync + Clone, R: Send + Sync + 'a,
{ /* private fields */ }

Implementations§

Source§

impl<'a, A, R> FunnyBot<'a, A, R>
where A: Send + Sync + Clone, R: Send + Sync + 'a + Clone,

Source

pub fn repeat(elt: R) -> Self

initialize Funnybot with a fixed value that will be repeated for each call

Source§

impl<'a, A, R> FunnyBot<'a, A, R>
where A: Send + Sync + Clone, R: Send + Sync + 'a,

Source

pub fn new(returns: Box<dyn Iterator<Item = R> + Send + Sync + 'a>) -> Self

Source

pub fn from_single(returns: R) -> Self

initialize Funnybot with a single return value. consequently calling more than once will panic

Source

pub fn from_list(returns: Vec<R>) -> Self

initialize Funnybot with a fixed list of return values. once the all values have returned, the function will panic

Source

pub fn repeat_with<F: 'a + Sync + Send + FnMut() -> R>(repeater: F) -> Self

initialize Funnybot with a repeater-function that generates values for each call

Source

pub fn call(&self, a: A) -> R

simulate a call

pass the arguments to record as a

returns the next value from the iterator as pre-programmed

Source

pub fn into_args(self) -> Vec<A>

return the recorded arguments. This consumes the Funnybot

Source

pub fn args(&self) -> RwLockReadGuard<'_, Vec<A>>

return a current snapshot of the recorded arguments

Auto Trait Implementations§

§

impl<'a, A, R> !Freeze for FunnyBot<'a, A, R>

§

impl<'a, A, R> RefUnwindSafe for FunnyBot<'a, A, R>

§

impl<'a, A, R> Send for FunnyBot<'a, A, R>

§

impl<'a, A, R> Sync for FunnyBot<'a, A, R>

§

impl<'a, A, R> Unpin for FunnyBot<'a, A, R>
where A: Unpin,

§

impl<'a, A, R> UnwindSafe for FunnyBot<'a, A, R>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where 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.

Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.