Canned

Struct Canned 

Source
pub struct Canned { /* private fields */ }
Expand description

A canned client: replies decided in advance, requests kept.

The seam’s second implementation, and a seam with one implementation is an abstraction nobody has checked. It is also what a Rust-level test uses when it wants to assert what a program sent, which a stub in Beck cannot see.

Implementations§

Source§

impl Canned

Source

pub fn new(replies: Vec<Result<Reply, Failure>>) -> Canned

Replies are handed out in order; a request past the end gets Failure::Unreachable.

Source

pub fn ok(body: &str) -> Canned

One 200 with this body, once.

Source

pub fn sent(&self) -> Vec<Request>

Trait Implementations§

Source§

impl Debug for Canned

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Canned

Source§

fn default() -> Canned

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

impl Outbound for Canned

Source§

fn fetch(&self, request: &Request) -> Result<Reply, Failure>

Auto Trait Implementations§

§

impl !Freeze for Canned

§

impl RefUnwindSafe for Canned

§

impl Send for Canned

§

impl Sync for Canned

§

impl Unpin for Canned

§

impl UnwindSafe for Canned

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.