Struct dredd_hooks::HooksServer
[−]
[src]
pub struct HooksServer { /* fields omitted */ }
Server that allows you to register hooks with the dredd test runner.
Methods
impl HooksServer
[src]
fn new() -> Self
Create a new instance.
fn start(srv: HooksServer, port: usize)
Start hook server with provided port.
Since the port of the hook server is usually determined by a IntegrationServer
(= dredd-hooks-rust
command)
there is a convenience method to pick up the correct port with start_from_env
.
fn start_from_env(srv: HooksServer)
Start hook server with port taken from the env as it is set by a IntegrationServer
.
fn before_all(
&mut self,
closure: Box<FnMut(Vec<Transaction>) -> Vec<Transaction> + Send + Sync>
)
&mut self,
closure: Box<FnMut(Vec<Transaction>) -> Vec<Transaction> + Send + Sync>
)
Register a hook that will run once before running any transactions.
fn before_each(
&mut self,
closure: Box<FnMut(Transaction) -> Transaction + Send + Sync>
)
&mut self,
closure: Box<FnMut(Transaction) -> Transaction + Send + Sync>
)
Register a hook that will run before each indiviual transactions.
fn before<T: Into<String>>(
&mut self,
name: T,
closure: Box<FnMut(Transaction) -> Transaction + Send + Sync>
)
&mut self,
name: T,
closure: Box<FnMut(Transaction) -> Transaction + Send + Sync>
)
Register a hook that will run before a specific transactions.
fn before_each_validation(
&mut self,
closure: Box<FnMut(Transaction) -> Transaction + Send + Sync>
)
&mut self,
closure: Box<FnMut(Transaction) -> Transaction + Send + Sync>
)
Register a hook that will run before the validation of each indiviual transactions.
fn before_validation<T: Into<String>>(
&mut self,
name: T,
closure: Box<FnMut(Transaction) -> Transaction + Send + Sync>
)
&mut self,
name: T,
closure: Box<FnMut(Transaction) -> Transaction + Send + Sync>
)
Register a hook that will run before a specific transactions will be validated.
fn after<T: Into<String>>(
&mut self,
name: T,
closure: Box<FnMut(Transaction) -> Transaction + Send + Sync>
)
&mut self,
name: T,
closure: Box<FnMut(Transaction) -> Transaction + Send + Sync>
)
Register a hook that will run after a specific transactions.
fn after_each(
&mut self,
closure: Box<FnMut(Transaction) -> Transaction + Send + Sync>
)
&mut self,
closure: Box<FnMut(Transaction) -> Transaction + Send + Sync>
)
Register a hook that will run after each indiviual transactions.
fn after_all(
&mut self,
closure: Box<FnMut(Vec<Transaction>) -> Vec<Transaction> + Send + Sync>
)
&mut self,
closure: Box<FnMut(Vec<Transaction>) -> Vec<Transaction> + Send + Sync>
)
Register a hook that will run once after running all other transactions.
Trait Implementations
impl Default for HooksServer
[src]
fn default() -> HooksServer
Returns the "default value" for a type. Read more
impl Clone for HooksServer
[src]
fn clone(&self) -> HooksServer
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Debug for HooksServer
[src]
impl Service for HooksServer
[src]
type Request = String
Requests handled by the service.
type Response = String
Responses given by the service.
type Error = Error
Errors produced by the service.
type Future = BoxFuture<Self::Response, Self::Error>
The future response value.
fn call(&self, req: Self::Request) -> Self::Future
Process the request and return the response asynchronously.