pub fn new(id: String, pact: Pact, addr: std::net::SocketAddr) -> Result<(MockServer, impl Future<Item = (), Error = ()>), String> {
        let (shutdown_tx, shutdown_rx) = futures::sync::oneshot::channel();
        let matches = Arc::new(Mutex::new(vec![]));

        let (future, socket_addr) = hyper_server::create_and_bind(
            pact.clone(),
            addr,
            shutdown_rx.map_err(|_| ()),
            matches.clone()
        ).map_err(|err| format!("Could not start server: {}", err))?;

        let mock_server = MockServer {
            id: id.clone(),
            addr: socket_addr,
            resources: vec![],
            pact: pact,
            matches: matches,
            shutdown_tx: Some(shutdown_tx)
        };

        Ok((mock_server, future))
    }
/// Create a new mock server, consisting of its state (self) and its executable server future.
Create a new mock server, consisting of its state (self) and its executable server future.
Create a new mock server consisting of its state ( self ) and its executable server future .
pub fn new(id: String, pact: Pact, addr: std::net::SocketAddr) -> Result<(MockServer, impl Future<Item = (), Error = ()>), String> {
        let (shutdown_tx, shutdown_rx) = futures::sync::oneshot::channel();
        let matches = Arc::new(Mutex::new(vec![]));
        let (future, socket_addr) = hyper_server::create_and_bind(
            pact.clone(),
            addr,
            shutdown_rx.map_err(|_| ()),
            matches.clone()
        ).map_err(|err| format!("Could not start server: {}", err))?;
        let mock_server = MockServer {
            id: id.clone(),
            addr: socket_addr,
            resources: vec![],
            pact: pact,
            matches: matches,
            shutdown_tx: Some(shutdown_tx)
        };
        Ok((mock_server, future))
    }
pub fn new ( id : String , pact : Pact , addr : std :: net :: SocketAddr ) -> Result < ( MockServer , impl Future < Item = ( ) , Error = ( ) > ) , String > { let ( shutdown_tx , shutdown_rx ) = futures :: sync :: oneshot :: channel ( ) ; let matches = Arc :: new ( Mutex :: new ( vec ! [ ] ) ) ; let ( future , socket_addr ) = hyper_server :: create_and_bind ( pact . clone ( ) , addr , shutdown_rx . map_err ( | _ | ( ) ) , matches . clone ( ) ) . map_err ( | err | format ! ( " " err ) ) ? ; let mock_server = MockServer { id : id . clone ( ) , addr : socket_addr , resources : vec ! [ ] , pact : pact , matches : matches , shutdown_tx : Some ( shutdown_tx ) } ; Ok ( ( mock_server , future ) ) }
Create a new mock server, consisting of its state (self) and its executable server future.
Create a new mock server consisting of its state ( self ) and its executable server future .
id
String
pact
Pact
addr
std::net::SocketAddr
id
String
pact
Pact
addr
std::net::SocketAddr