chandeliers_sem/
lib.rs

1//! Tools for defining the semantics of Lustre.
2
3#![feature(lint_reasons)]
4#![warn(missing_docs)]
5#![warn(
6    unused_crate_dependencies,
7    unused_macro_rules,
8    variant_size_differences,
9    clippy::allow_attributes,
10    clippy::allow_attributes_without_reason,
11    clippy::expect_used,
12    clippy::indexing_slicing,
13    clippy::missing_docs_in_private_items,
14    clippy::missing_inline_in_public_items,
15    clippy::multiple_inherent_impl,
16    clippy::panic,
17    clippy::pedantic,
18    clippy::str_to_string,
19    clippy::unreachable,
20    clippy::unwrap_used,
21    clippy::use_debug
22)]
23
24#[cfg(test)]
25mod tests;
26
27pub mod nillable;
28
29pub mod time_travel;
30
31pub mod stepping;
32
33pub mod registers;
34
35#[macro_use]
36pub mod candle;
37
38/// Stream traits.
39pub mod traits {
40    pub use crate::nillable::AllNil;
41    pub use crate::stepping::{Embed, Step, Trusted};
42    pub use crate::time_travel::{Ago, SealedVisible, Update};
43
44    /// Can be trivially manipulated, converted to another scalar,
45    /// and trivially embedded.
46    // The bounds guarantee that this type is...
47    pub trait Scalar:
48        // Initializable
49        Default
50        // Trivial to embed and remember past values of
51        + Sized
52        + Embed<Target = crate::nillable::Nillable<Self>>
53        + SealedVisible
54        + Copy
55        // Printable in a debug trace
56        + std::fmt::Display
57    {
58    }
59
60    impl Scalar for bool {}
61    impl Scalar for i64 {}
62    impl Scalar for f64 {}
63}
64
65/// The macros that define the semantics of Candle by translating it to Rust.
66pub mod macros {
67    /// Assertion:
68    pub use crate::truth;
69    /// Debugging:
70    pub use crate::{assert_is, node_trace};
71    /// Expression combinator:
72    pub use crate::{binop, cmp, float, ifx, later, substep, unop};
73    /// Statement:
74    pub use crate::{implicit_clock, tick, update};
75    /// Expression:
76    pub use crate::{lit, nil, var};
77    /// Type:
78    pub use crate::{ty, ty_mapping};
79}