Struct toxiproxy_rust::TOXIPROXY[][src]

pub struct TOXIPROXY { /* fields omitted */ }

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

impl Deref for TOXIPROXY[src]

type Target = Client

The resulting type after dereferencing.

impl LazyStatic for TOXIPROXY[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.