pub struct TestnetBuilder { /* private fields */ }Expand description
Builder for creating a Testnet with custom configuration.
§Defaults
bind_address:127.0.0.1(localhost)seeded:true- nodes start with fully populated routing tables
§Example
ⓘ
use std::net::Ipv4Addr;
use mainline::Testnet;
// Use localhost (default)
let testnet = Testnet::builder(3).build().unwrap();
// Use all interfaces (0.0.0.0)
let testnet = Testnet::builder(3)
.bind_address(Ipv4Addr::UNSPECIFIED)
.build()
.unwrap();Implementations§
Source§impl TestnetBuilder
impl TestnetBuilder
Sourcepub fn new(count: usize) -> Self
pub fn new(count: usize) -> Self
Create a new builder with the specified number of nodes.
§Defaults
bind_address:127.0.0.1(localhost)seeded:true
Sourcepub fn bind_address(&mut self, bind_address: Ipv4Addr) -> &mut Self
pub fn bind_address(&mut self, bind_address: Ipv4Addr) -> &mut Self
Set the address to bind all nodes to.
Defaults to 127.0.0.1 (localhost).
Use Ipv4Addr::UNSPECIFIED (0.0.0.0) to bind to all interfaces.
Sourcepub fn seeded(&mut self, seeded: bool) -> &mut Self
pub fn seeded(&mut self, seeded: bool) -> &mut Self
Whether to pre-seed routing tables with all nodes.
Defaults to true.
When true, all nodes start with fully populated routing tables.
When false, nodes bootstrap from each other which is faster at startup
but may not have immediate full connectivity.
Trait Implementations§
Source§impl Clone for TestnetBuilder
impl Clone for TestnetBuilder
Source§fn clone(&self) -> TestnetBuilder
fn clone(&self) -> TestnetBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TestnetBuilder
impl RefUnwindSafe for TestnetBuilder
impl Send for TestnetBuilder
impl Sync for TestnetBuilder
impl Unpin for TestnetBuilder
impl UnwindSafe for TestnetBuilder
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