[][src]Struct rr_mux::mock::MockConnector

pub struct MockConnector<Addr, Req, Resp, E, Ctx> { /* fields omitted */ }

MockConnector provides an expectation based mock connector implementation to simplify writing tests against modules using the Connector abstraction.

Methods

impl<Addr, Req, Resp, E, Ctx> MockConnector<Addr, Req, Resp, E, Ctx> where
    Addr: PartialEq + Debug + Send + 'static,
    Req: PartialEq + Debug + Send + 'static,
    Resp: PartialEq + Debug + Send + 'static,
    E: PartialEq + Debug + Send + 'static,
    Ctx: Clone + PartialEq + Debug + Send + 'static, 
[src]

pub fn new() -> MockConnector<Addr, Req, Resp, E, Ctx>[src]

Create a new mock connector

pub fn expect<T>(&mut self, transactions: T) -> Self where
    T: Into<VecDeque<MockTransaction<Addr, Req, Resp, Ctx, E>>>, 
[src]

Set expectations on the connector

pub fn finalise(&mut self)[src]

Finalise expectations on the connector

Trait Implementations

impl<Addr, Req, Resp, E, Ctx> Clone for MockConnector<Addr, Req, Resp, E, Ctx>[src]

impl<Id, Addr, Req, Resp, E, Ctx> Connector<Id, Addr, Req, Resp, E, Ctx> for MockConnector<Addr, Req, Resp, E, Ctx> where
    Id: PartialEq + Debug + Send + 'static,
    Addr: PartialEq + Debug + Send + 'static,
    Req: PartialEq + Debug + Send + 'static,
    Resp: PartialEq + Debug + Send + 'static,
    E: PartialEq + Debug + Send + 'static,
    Ctx: Clone + PartialEq + Debug + Send + 'static, 
[src]

fn request<'life0, 'async_trait>(
    &'life0 mut self,
    ctx: Ctx,
    _id: Id,
    addr: Addr,
    req: Req
) -> Pin<Box<dyn Future<Output = Result<Resp, E>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Make a request and return the pre-set response This checks the request against the specified expectations

fn respond<'life0, 'async_trait>(
    &'life0 mut self,
    ctx: Ctx,
    _id: Id,
    addr: Addr,
    resp: Resp
) -> Pin<Box<dyn Future<Output = Result<(), E>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Make a response This checks the response against provided expectations

Auto Trait Implementations

impl<Addr, Req, Resp, E, Ctx> RefUnwindSafe for MockConnector<Addr, Req, Resp, E, Ctx> where
    Ctx: RefUnwindSafe

impl<Addr, Req, Resp, E, Ctx> Send for MockConnector<Addr, Req, Resp, E, Ctx> where
    Addr: Send,
    Ctx: Send,
    E: Send,
    Req: Send,
    Resp: Send

impl<Addr, Req, Resp, E, Ctx> Sync for MockConnector<Addr, Req, Resp, E, Ctx> where
    Addr: Send,
    Ctx: Send + Sync,
    E: Send,
    Req: Send,
    Resp: Send

impl<Addr, Req, Resp, E, Ctx> Unpin for MockConnector<Addr, Req, Resp, E, Ctx> where
    Ctx: Unpin

impl<Addr, Req, Resp, E, Ctx> UnwindSafe for MockConnector<Addr, Req, Resp, E, Ctx> where
    Ctx: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.