Trait noir::MockRequest [] [src]

pub trait MockRequest: Send + Any {
    fn validate(&mut self) -> Option<String>;
    fn as_any(&self) -> &Any;
    fn as_any_mut(&mut self) -> &mut Any;

    fn downcast_ref<'a>(request: &'a Box<MockRequest>) -> Option<&'a Self> where Self: Any + Send + Sized + 'static { ... }
    fn downcast_mut<'a>(request: &'a mut Box<MockRequest>) -> Option<&'a mut Self> where Self: Any + Send + Sized + 'static { ... }
}

A trait for implementation of a request matched against concrete types of MockResponse.

Required Methods

fn validate(&mut self) -> Option<String>

If the request has no matching MockResponse return a error message.

Test Failure

If Some(String) is returned.

fn as_any(&self) -> &Any

Method for casting the concrete implementation of MockRequest into a &Any for use with MockRequest::downcast_ref().

This must be implemented on the concrete type in order for the &Any to have the correct type id for downcasting.

Concrete Implementation

fn as_any(&self) -> &Any {
    self
}

fn as_any_mut(&mut self) -> &mut Any

Method for casting the concrete implementation of MockRequest into a &mut Any for use with MockRequest::downcast_mut().

This must be implemented on the concrete type in order for the &mut Any to have the correct type id for downcasting.

Concrete Implementation

fn as_any_mut(&mut self) -> &mut Any {
    self
}

Provided Methods

fn downcast_ref<'a>(request: &'a Box<MockRequest>) -> Option<&'a Self> where Self: Any + Send + Sized + 'static

A helper for downcasting a MockRequest trait object into one of its concrete types.

fn downcast_mut<'a>(request: &'a mut Box<MockRequest>) -> Option<&'a mut Self> where Self: Any + Send + Sized + 'static

Mutable version of MockRequest::downcast_ref.

Implementors