Struct toxiproxy_rust::TOXIPROXY [−][src]
Pre-built client using the default connection address.
Methods from Deref<Target = Client>
pub fn populate(&self, proxies: Vec<ProxyPack>) -> Result<Vec<Proxy>, String>
[src]
Establish a set of proxies to work with.
Examples
let client = Client::new("127.0.0.1:8474"); let proxies = client.populate(vec![ProxyPack::new( "socket".into(), "localhost:2001".into(), "localhost:2000".into(), )]).expect("populate has completed");
let proxies = toxiproxy_rust::TOXIPROXY.populate(vec![toxiproxy_rust::proxy::ProxyPack::new( "socket".into(), "localhost:2001".into(), "localhost:2000".into(), )]).expect("populate has completed");
pub fn reset(&self) -> Result<(), String>
[src]
Enable all proxies and remove all active toxics.
Examples
let client = Client::new("127.0.0.1:8474"); client.reset();
toxiproxy_rust::TOXIPROXY.reset();
pub fn all(&self) -> Result<HashMap<String, Proxy>, String>
[src]
Returns all registered proxies and their toxics.
Examples
let proxies = toxiproxy_rust::TOXIPROXY.all().expect("all proxies were fetched");
pub fn is_running(&self) -> bool
[src]
Health check for the Toxiproxy server.
Examples
if !toxiproxy_rust::TOXIPROXY.is_running() { /* signal the problem */ }
pub fn version(&self) -> Result<String, String>
[src]
Version of the Toxiproxy server.
Examples
let version = toxiproxy_rust::TOXIPROXY.version().expect("version is returned");
pub fn find_and_reset_proxy(&self, name: &str) -> Result<Proxy, String>
[src]
Fetches a proxy a resets its state (remove active toxics). Usually a good way to start a test and to start setting up toxics fresh against the proxy.
Examples
let proxy = toxiproxy_rust::TOXIPROXY.find_and_reset_proxy("socket").expect("proxy returned");
pub fn find_proxy(&self, name: &str) -> Result<Proxy, String>
[src]
Fetches a proxy. Useful to fetch a proxy for a test where more fine grained control is required over a proxy and its toxics.
Examples
let proxy = toxiproxy_rust::TOXIPROXY.find_proxy("socket").expect("proxy returned");
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for TOXIPROXY
impl Send for TOXIPROXY
impl Sync for TOXIPROXY
impl Unpin for TOXIPROXY
impl UnwindSafe for TOXIPROXY
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,