1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//! Browser-agnostic HTTP/HTTPS fetching library.
//!
//! Two APIs are available depending on how much control you need:
//!
//! - [`simple_get`] — one-shot GET, no setup required.
//! - [`Fetcher`] — priority-scheduled fetcher with request coalescing,
//! per-origin concurrency limits, and fan-out to multiple subscribers.
//!
//! For the full scheduler, implement [`FetcherContext`] to receive lifecycle callbacks,
//! or use [`NullContext`] if you don't need any:
//!
//! ```no_run
//! use std::sync::Arc;
//! use gosub_sonar::{FetchRequest, Fetcher, FetcherConfig, NullContext};
//! use http::Method;
//! use tokio_util::sync::CancellationToken;
//! use url::Url;
//!
//! # async fn example() -> anyhow::Result<()> {
//! let fetcher = Arc::new(Fetcher::new(FetcherConfig::default(), Arc::new(NullContext))?);
//!
//! let shutdown = CancellationToken::new();
//! tokio::spawn({
//! let f = fetcher.clone();
//! let cancel = shutdown.clone();
//! async move { f.run(cancel).await }
//! });
//!
//! let req = FetchRequest::builder(Method::GET, Url::parse("https://example.org")?).build();
//! let result = fetcher.fetch(req).await;
//! # Ok(())
//! # }
//! ```
//!
//! The most common types are re-exported at the crate root; the full API remains
//! available under [`net`].
//!
//! # Examples
//!
//! Runnable examples are in the `examples/` directory:
//!
//! - `simple_fetch` — one-shot GET using [`simple_get`]
//! - `fetcher` — minimal [`Fetcher`] setup with a no-op context
//! - `fetcher_harness` — self-contained harness covering concurrency, coalescing, priority, cancellation, and errors
pub use ;
pub use ;
pub use NullEmitter;
pub use NetObserver;
pub use RequestReference;
pub use SharedBody;
pub use ;
pub use ;
pub use ;