docs: correct application runtime example

This commit is contained in:
DeFiDude committed 2026-08-17 12:29:35 -06:00
1 parent cfb7253f99
commit 51763a97dc
1 file changed
+19 -8
+19 -8
View File
@@ -11,17 +11,28 @@ announces, packets and receipts, persistent Links, requests, Channels, Buffer
streams, Resources, and RNode observation.
```rust
use std::sync::Arc;
use std::sync::atomic::AtomicBool;
use rns_runtime::prelude::*;
# async fn example() -> Result<(), Box<dyn std::error::Error>> {
let runtime = init().await?;
let identity = Identity::new();
#[tokio::main]
async fn main() -> Result<(), ReticulumError> {
let shutdown = ShutdownSignal::new();
let runtime = init(
None,
None,
shutdown,
Arc::new(AtomicBool::new(true)),
)
.await?;
let identity = Identity::new();
// Application work owns `runtime`; shutdown is explicit and awaitable.
runtime.shutdown().await;
# let _ = identity;
# Ok(())
# }
// Application work owns `runtime`; shutdown is explicit and awaitable.
runtime.shutdown_and_wait().await;
drop(identity);
Ok(())
}
```
Finite destination discovery uses `resolve_destination_on_transport` with one