hydro_lang/
lib.rs

1#![cfg_attr(docsrs, feature(doc_cfg))]
2#![warn(missing_docs)]
3
4//! Hydro is a high-level distributed programming framework for Rust.
5//! Hydro can help you quickly write scalable distributed services that are correct by construction.
6//! Much like Rust helps with memory safety, Hydro helps with [distributed safety](https://hydro.run/docs/hydro/correctness).
7//!
8//! The core Hydro API involves [live collections](https://hydro.run/docs/hydro/live-collections/), which represent asynchronously
9//! updated sources of data such as incoming network requests and application state. The most common live collection is a [`Stream`];
10//! other live collections can be found in modules inside this crate.
11//!
12//! Hydro uses a unique compilation approach where you define deployment logic as Rust code alongside your distributed system implementation.
13//! For more details on this API, see the [Hydro docs](https://hydro.run/docs/hydro/deploy/) and the [`deploy`] module.
14
15stageleft::stageleft_no_entry_crate!();
16
17pub use stageleft::q;
18
19#[cfg(feature = "runtime_support")]
20#[cfg_attr(docsrs, doc(cfg(feature = "runtime_support")))]
21#[doc(hidden)]
22pub mod runtime_support {
23    pub use {bincode, dfir_rs, stageleft, tokio};
24    pub mod resource_measurement;
25}
26
27#[doc(hidden)]
28pub mod internal_constants {
29    pub const CPU_USAGE_PREFIX: &str = "CPU:";
30    // Should remain consistent with dfir_lang/src/graph/ops/_counter.rs
31    pub const COUNTER_PREFIX: &str = "_counter";
32}
33
34#[cfg(feature = "dfir_context")]
35#[cfg_attr(docsrs, doc(cfg(feature = "dfir_context")))]
36#[expect(missing_docs, reason = "TODO")]
37pub mod runtime_context;
38#[cfg(feature = "dfir_context")]
39#[cfg_attr(docsrs, doc(cfg(feature = "dfir_context")))]
40pub use runtime_context::RUNTIME_CONTEXT;
41
42#[expect(missing_docs, reason = "TODO")]
43pub mod unsafety;
44pub use unsafety::*;
45
46#[expect(missing_docs, reason = "TODO")]
47pub mod boundedness;
48pub use boundedness::{Bounded, Unbounded};
49
50#[expect(missing_docs, reason = "TODO")]
51pub mod stream;
52pub use stream::{NoOrder, Stream, TotalOrder};
53
54#[expect(missing_docs, reason = "TODO")]
55pub mod keyed_singleton;
56#[expect(missing_docs, reason = "TODO")]
57pub mod keyed_stream;
58pub use keyed_stream::KeyedStream;
59
60#[expect(missing_docs, reason = "TODO")]
61pub mod singleton;
62pub use singleton::Singleton;
63
64#[expect(missing_docs, reason = "TODO")]
65pub mod optional;
66pub use optional::Optional;
67
68#[expect(missing_docs, reason = "TODO")]
69pub mod location;
70pub use location::cluster::CLUSTER_SELF_ID;
71pub use location::{Atomic, Cluster, External, Location, MemberId, NetworkHint, Process, Tick};
72
73#[cfg(feature = "build")]
74#[cfg_attr(docsrs, doc(cfg(feature = "build")))]
75#[expect(missing_docs, reason = "TODO")]
76pub mod deploy;
77
78#[expect(missing_docs, reason = "TODO")]
79pub mod deploy_runtime;
80
81#[expect(missing_docs, reason = "TODO")]
82pub mod cycle;
83
84#[expect(missing_docs, reason = "TODO")]
85pub mod builder;
86pub use builder::FlowBuilder;
87
88mod manual_expr;
89
90#[expect(missing_docs, reason = "TODO")]
91pub mod ir;
92
93#[cfg(feature = "viz")]
94#[expect(missing_docs, reason = "TODO")]
95pub mod graph;
96
97#[cfg(feature = "viz")]
98#[cfg_attr(docsrs, doc(cfg(feature = "viz")))]
99#[expect(missing_docs, reason = "TODO")]
100pub mod graph_util;
101
102#[expect(missing_docs, reason = "TODO")]
103pub mod rewrites;
104
105mod staging_util;
106
107#[expect(missing_docs, reason = "TODO")]
108pub mod backtrace;
109
110#[cfg(feature = "deploy")]
111#[cfg_attr(docsrs, doc(cfg(feature = "deploy")))]
112#[expect(missing_docs, reason = "TODO")]
113pub mod test_util;
114
115#[cfg(feature = "build")]
116#[ctor::ctor]
117fn init_rewrites() {
118    stageleft::add_private_reexport(
119        vec!["tokio_util", "codec", "lines_codec"],
120        vec!["tokio_util", "codec"],
121    );
122}
123
124#[cfg(test)]
125mod test_init {
126    #[ctor::ctor]
127    fn init() {
128        crate::deploy::init_test();
129    }
130}