pub struct SimpleServiceRegistry { /* private fields */ }
Implementations§
Source§impl SimpleServiceRegistry
impl SimpleServiceRegistry
Sourcepub fn new(default_tcp: SocketAddr, default_tls: SocketAddr) -> Self
pub fn new(default_tcp: SocketAddr, default_tls: SocketAddr) -> Self
Examples found in repository?
examples/benchmark_clients.rs (line 92)
79async fn main() {
80 let args: Args = argh::from_env();
81
82 #[cfg(feature = "quic")]
83 rustls::crypto::ring::default_provider().install_default().expect("should install ring as default");
84
85 //if RUST_LOG env is not set, set it to info
86 let level = match std::env::var("RUST_LOG") {
87 Ok(v) => LevelFilter::from_str(&v).unwrap_or(LevelFilter::Info),
88 _ => LevelFilter::Info,
89 };
90 PicoLogger::new(level).init();
91
92 let registry = SimpleServiceRegistry::new(args.http_dest, args.https_dest);
93 let registry = Arc::new(registry);
94
95 for client in 0..args.clients {
96 let args_c = args.clone();
97 let registry = registry.clone();
98 tokio::spawn(async move {
99 connect(client, args_c, registry).await;
100 });
101 sleep(Duration::from_millis(args.connect_wait_ms)).await;
102 }
103
104 loop {
105 sleep(Duration::from_millis(1000)).await;
106 }
107}
pub fn set_tcp_service(&mut self, service: u16, dest: SocketAddr)
pub fn set_tls_service(&mut self, service: u16, dest: SocketAddr)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SimpleServiceRegistry
impl RefUnwindSafe for SimpleServiceRegistry
impl Send for SimpleServiceRegistry
impl Sync for SimpleServiceRegistry
impl Unpin for SimpleServiceRegistry
impl UnwindSafe for SimpleServiceRegistry
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