#![cfg_attr(docsrs, feature(doc_cfg))]
#![cfg_attr(not(stageleft_trybuild), warn(missing_docs))]
stageleft::stageleft_no_entry_crate!();
#[cfg(feature = "runtime_support")]
#[cfg_attr(docsrs, doc(cfg(feature = "runtime_support")))]
#[doc(hidden)]
pub mod runtime_support {
pub use ::{bincode, dfir_rs, slotmap, stageleft, tokio};
#[cfg(feature = "sim")]
pub use colored;
#[cfg(feature = "deploy_integration")]
pub use hydro_deploy_integration;
#[cfg(any(feature = "deploy_integration", feature = "docker_runtime"))]
pub mod launch;
}
#[doc(hidden)]
pub mod macro_support {
pub use copy_span;
}
pub mod prelude {
pub use stageleft::q;
pub use crate::compile::builder::FlowBuilder;
pub use crate::live_collections::boundedness::{Bounded, Unbounded};
pub use crate::live_collections::keyed_singleton::KeyedSingleton;
pub use crate::live_collections::keyed_stream::KeyedStream;
pub use crate::live_collections::optional::Optional;
pub use crate::live_collections::singleton::Singleton;
pub use crate::live_collections::sliced::sliced;
pub use crate::live_collections::stream::Stream;
pub use crate::location::{Cluster, External, Location as _, Process, Tick};
pub use crate::networking::TCP;
pub use crate::nondet::{NonDet, nondet};
pub use crate::properties::{ManualProof, manual_proof};
#[macro_export]
macro_rules! setup {
() => {
stageleft::stageleft_no_entry_crate!();
#[cfg(test)]
mod test_init {
#[ctor::ctor]
fn init() {
$crate::compile::init_test();
}
}
};
}
}
#[cfg(feature = "dfir_context")]
#[cfg_attr(docsrs, doc(cfg(feature = "dfir_context")))]
pub mod runtime_context;
pub mod nondet;
pub mod live_collections;
pub mod location;
pub mod networking;
pub mod properties;
pub mod telemetry;
#[cfg(any(
feature = "deploy",
feature = "deploy_integration" // hidden internal feature enabled in the trybuild
))]
#[cfg_attr(docsrs, doc(cfg(feature = "deploy")))]
pub mod deploy;
#[cfg(feature = "sim")]
#[cfg_attr(docsrs, doc(cfg(feature = "sim")))]
pub mod sim;
pub mod forward_handle;
pub mod compile;
mod manual_expr;
#[cfg(stageleft_runtime)]
#[cfg(feature = "viz")]
#[cfg_attr(docsrs, doc(cfg(feature = "viz")))]
#[expect(missing_docs, reason = "TODO")]
pub mod viz;
#[cfg_attr(
feature = "stageleft_macro_entrypoint",
expect(missing_docs, reason = "staging internals")
)]
mod staging_util;
#[cfg(feature = "deploy")]
#[cfg_attr(docsrs, doc(cfg(feature = "deploy")))]
pub mod test_util;
#[cfg(feature = "build")]
#[ctor::ctor]
fn init_rewrites() {
stageleft::add_private_reexport(
vec!["tokio_util", "codec", "lines_codec"],
vec!["tokio_util", "codec"],
);
}
#[cfg(all(test, feature = "trybuild"))]
mod test_init {
#[ctor::ctor]
fn init() {
crate::compile::init_test();
}
}
#[doc(hidden)]
#[macro_export]
macro_rules! newtype_counter {
(
$(
$( #[$attr:meta] )*
$vis:vis struct $name:ident($typ:ty);
)*
) => {
$(
$( #[$attr] )*
#[repr(transparent)]
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
$vis struct $name($typ);
#[allow(clippy::allow_attributes, dead_code, reason = "macro-generated methods may be unused")]
impl $name {
pub fn get_and_increment(&mut self) -> Self {
let id = self.0;
self.0 += 1;
Self(id)
}
pub fn range_up_to(&self) -> impl std::iter::DoubleEndedIterator<Item = Self>
+ std::iter::FusedIterator
{
(0..self.0).map(Self)
}
pub fn into_inner(self) -> $typ {
self.0
}
}
impl std::fmt::Display for $name {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.0)
}
}
impl serde::ser::Serialize for $name {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer
{
serde::ser::Serialize::serialize(&self.0, serializer)
}
}
impl<'de> serde::de::Deserialize<'de> for $name {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>
{
serde::de::Deserialize::deserialize(deserializer).map(Self)
}
}
)*
};
}