[][src]Struct ethers_core::utils::Ganache

pub struct Ganache { /* fields omitted */ }

Builder for launching ganache-cli.

Panics

If spawn is called without ganache-cli being available in the user's $PATH

Example

use ethers::utils::Ganache;

let port = 8545u64;
let url = format!("http://localhost:{}", port).to_string();

let ganache = Ganache::new()
    .port(port)
    .mnemonic("abstract vacuum mammal awkward pudding scene penalty purchase dinner depart evoke puzzle")
    .spawn();

drop(ganache); // this will kill the instance

Implementations

impl Ganache[src]

pub fn new() -> Self[src]

Creates an empty Ganache builder. The default port is 8545. The mnemonic is chosen randomly.

pub fn port<T: Into<u64>>(self, port: T) -> Self[src]

Sets the port which will be used when the ganache-cli instance is launched.

pub fn mnemonic<T: Into<String>>(self, mnemonic: T) -> Self[src]

Sets the mnemonic which will be used when the ganache-cli instance is launched.

pub fn block_time<T: Into<u64>>(self, block_time: T) -> Self[src]

Sets the block-time which will be used when the ganache-cli instance is launched.

pub fn spawn(self) -> GanacheInstance[src]

Consumes the builder and spawns ganache-cli with stdout redirected to /dev/null. This takes ~2 seconds to execute as it blocks while waiting for ganache-cli to launch.

Trait Implementations

impl Clone for Ganache[src]

impl Default for Ganache[src]

Auto Trait Implementations

impl RefUnwindSafe for Ganache

impl Send for Ganache

impl Sync for Ganache

impl Unpin for Ganache

impl UnwindSafe for Ganache

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, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,