pub struct ContractManager { /* private fields */ }Expand description
Contract manager
Implementations§
Source§impl ContractManager
impl ContractManager
Sourcepub fn new(contracts_dir: PathBuf) -> Self
pub fn new(contracts_dir: PathBuf) -> Self
Create new contract manager
§Examples
use armature_testing::contract::ContractManager;
use std::path::PathBuf;
let manager = ContractManager::new(PathBuf::from("./pacts"));Sourcepub fn load(
&self,
consumer: &str,
provider: &str,
) -> Result<Contract, ContractError>
pub fn load( &self, consumer: &str, provider: &str, ) -> Result<Contract, ContractError>
Load contract from file
Sourcepub fn list(&self) -> Result<Vec<(String, String)>, ContractError>
pub fn list(&self) -> Result<Vec<(String, String)>, ContractError>
List all contracts.
Reads consumer/provider names back out of each contract file’s JSON
body (Contract::consumer/Contract::provider), rather than
splitting the filename on -: save() lowercases and joins the
names with - to build {consumer}-{provider}.json, which is not
reversible by splitting when either name itself contains a hyphen
(e.g. consumer "my-service" -> filename my-service-backend.json
would misparse as consumer "my", provider "service"). Reading the
JSON instead means the returned pairs always round-trip into
load(), whatever characters the original names contained.
Auto Trait Implementations§
impl Freeze for ContractManager
impl RefUnwindSafe for ContractManager
impl Send for ContractManager
impl Sync for ContractManager
impl Unpin for ContractManager
impl UnsafeUnpin for ContractManager
impl UnwindSafe for ContractManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<R, D> DepsPresent<D> for R
Source§impl<T> Injectable for T
impl<T> Injectable for T
Source§fn type_id_of() -> TypeIdwhere
Self: Sized,
fn type_id_of() -> TypeIdwhere
Self: Sized,
Returns the TypeId of this type (for internal use)
Source§fn type_name_of() -> &'static strwhere
Self: Sized,
fn type_name_of() -> &'static strwhere
Self: Sized,
Returns the type name for debugging