var searchIndex = {}; searchIndex["pact_mock_server"] = {"doc":"The `libpact_mock_server` crate provides the in-process mock server for mocking HTTP requests\nand generating responses based on a pact file. It implements the V1.1 Pact specification\n(https://github.com/pact-foundation/pact-specification/tree/version-1.1).","items":[[3,"MockServer","pact_mock_server","Struct to represent a mock server",null,null],[12,"id","","Mock server unique ID",0,null],[12,"port","","Port the mock server is running on",0,null],[12,"server","","Address of the server implementing the `Listening` trait",0,null],[12,"matches","","List of all match results for requests this mock server has received",0,null],[12,"resources","","List of resources that need to be cleaned up when the mock server completes",0,null],[12,"pact","","Pact that this mock server is based on",0,null],[4,"MatchResult","","Enum to define a match result",null,null],[13,"RequestMatch","","Match result where the request was sucessfully matched",1,null],[13,"RequestMismatch","","Match result where there were a number of mismatches",1,null],[13,"RequestNotFound","","Match result where the request was not expected",1,null],[13,"MissingRequest","","Match result where an expected request was not received",1,null],[5,"start_mock_server","","Starts a mock server with the given ID, pact and port number. The ID needs to be unique. A port\nnumber of 0 will result in an auto-allocated port by the operating system. Returns the port\nthat the mock server is running on wrapped in a `Result`.",null,{"inputs":[{"name":"string"},{"name":"pact"},{"name":"i32"}],"output":{"name":"result"}}],[5,"lookup_mock_server","","Looks up the mock server by ID, and passes it into the given closure. The result of the\nclosure is returned wrapped in an `Option`. If no mock server is found with that ID, `None`\nis returned.",null,{"inputs":[{"name":"string"},{"name":"fn"}],"output":{"name":"option"}}],[5,"lookup_mock_server_by_port","","Looks up the mock server by port number, and passes it into the given closure. The result of the\nclosure is returned wrapped in an `Option`. If no mock server is found with that port number, `None`\nis returned.",null,{"inputs":[{"name":"i32"},{"name":"fn"}],"output":{"name":"option"}}],[5,"iterate_mock_servers","","Iterates through all the mock servers, passing each one to the given closure.",null,{"inputs":[{"name":"fnmut"}],"output":null}],[5,"shutdown_mock_server","","Shuts and cleans up the mock server with the given id. Returns true if a mock server was\nfound, false otherwise.",null,{"inputs":[{"name":"string"}],"output":{"name":"bool"}}],[5,"shutdown_mock_server_by_port","","Shuts and cleans up the mock server with the given port. Returns true if a mock server was\nfound, false otherwise.",null,{"inputs":[{"name":"i32"}],"output":{"name":"bool"}}],[5,"create_mock_server","","External interface to create a mock server. A pointer to the pact JSON as a C string is passed in,\nas well as the port for the mock server to run on. A value of 0 for the port will result in a\nport being allocated by the operating system. The port of the mock server is returned.",null,null],[5,"mock_server_matched","","External interface to check if a mock server has matched all its requests. The port number is\npassed in, and if all requests have been matched, true is returned. False is returned if there\nis no mock server on the given port, or if any request has not been successfully matched, or\nthe method panics.",null,{"inputs":[{"name":"int32_t"}],"output":{"name":"bool"}}],[5,"mock_server_mismatches","","External interface to get all the mismatches from a mock server. The port number of the mock\nserver is passed in, and a pointer to a C string with the mismatches in JSON format is\nreturned.",null,null],[5,"cleanup_mock_server","","External interface to cleanup a mock server. This function will try terminate the mock server\nwith the given port number and cleanup any memory allocated for it. Returns true, unless a\nmock server with the given port number does not exist, or the function panics.",null,{"inputs":[{"name":"int32_t"}],"output":{"name":"bool"}}],[5,"write_pact_file","","External interface to trigger a mock server to write out its pact file. This function should\nbe called if all the consumer tests have passed. The directory to write the file to is passed\nas the second parameter. If a NULL pointer is passed, the current working directory is used.",null,null],[11,"eq","","",1,null],[11,"ne","","",1,null],[11,"clone","","",1,null],[11,"fmt","","",1,null],[11,"match_key","","Returns the match key for this mismatch",1,null],[11,"matched","","Returns true if this match result is a `RequestMatch`",1,null],[11,"to_json","","Converts this match result to a `Json` struct",1,null],[11,"new","","Creates a new mock server with the given ID and pact",0,{"inputs":[{"name":"string"},{"name":"pact"}],"output":{"name":"mockserver"}}],[11,"port","","Sets the port that the mock server is listening on",0,null],[11,"server","","Sets the address of the server implementing the `Listening` trait",0,null],[11,"to_json","","Converts this mock server to a `Json` struct",0,null],[11,"mismatches","","Returns all the mismatches that have occured with this mock server",0,null],[11,"write_pact","","Mock server writes it pact out to the provided directory",0,null],[11,"eq","","",0,null]],"paths":[[3,"MockServer"],[4,"MatchResult"]]}; initSearch(searchIndex);