Skip to main content

formally_support/
lib.rs

1//
2// ::formally - the open-source formal methods toolchain
3//
4// Copyright (c) 2025 Nicola Gigante
5//
6// Permission is hereby granted, free of charge, to any person obtaining a copy
7// of this software and associated documentation files (the "Software"), to deal
8// in the Software without restriction, including without limitation the rights
9// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10// copies of the Software, and to permit persons to whom the Software is
11// furnished to do so, subject to the following conditions:
12//
13// The above copyright notice and this permission notice shall be included in
14// all copies or substantial portions of the Software.
15//
16// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22// SOFTWARE.
23//
24
25//! Support utilities common to all `formally` submodules.
26#![doc = ""]
27#![cfg_attr(
28    not(feature = "__subcratedoc"),
29    doc = "**WARNING: This crate is not supposed to be used directly.**"
30)]
31#![doc = ""]
32#![cfg_attr(
33    not(feature = "__subcratedoc"),
34    doc = "**Use instead the `formally::support` module of the main `formally` crate.**"
35)]
36#![doc = ""]
37//!
38//! The [support][self] crate includes several components used throughout all the `formally` modules
39//! and frequently used by any client code.
40//!
41//! These include:
42//! 2. The *diagnostics* system, including the [error] macro, the [Emitter] trait and different
43//!    types of *emitters*.
44//! 3. The [Scope] type to help implementing statically scoped languages.
45//! 4. Utilities to represent and keep track of *source locations*, including the [Location] and the
46//!    [Span] types.
47//! 5. Procedural macros to derive the `Located` and `Locatable` traits.
48//! 6. The [Nominal] smart pointer.
49//! 7. The [Stack] trait and the [Stacked] utility type to help implementing it.
50//! 8. The [SArc] wrapper over either an [Arc](std::sync::Arc) or a static reference to an object.
51
52mod formally {
53    pub extern crate self as support;
54}
55
56#[doc(inline)]
57pub use formally_support_macros::*;
58
59mod diagnostics;
60mod location;
61mod nominal;
62mod sarc;
63mod scope;
64mod stack;
65
66pub use diagnostics::*;
67pub use location::*;
68pub use nominal::*;
69pub use sarc::*;
70pub use scope::*;
71pub use stack::*;