luau_parser/types/mod.rs
1//! # Types module
2//!
3//! This just reexports the struct and traits for easier importing.
4//!
5//! ## Note
6//!
7//! This file only contains the definitions for items, for actual implementations,
8//! check the files under `src/impl`. Each type will have it's implementation in
9//! the same place, ex. types in `types/value/function.rs` will have
10//! their implementations in `impl/value/function.rs`. The only `impl`
11//! here is for `Statement`, and it isn't exposed directly to consumers of this
12//! crate, but rather through other functions.
13
14#[cfg(not(feature = "async"))]
15use std::rc::Rc as PointerInner;
16#[cfg(feature = "async")]
17use std::sync::Arc as PointerInner;
18
19/// A helper macro to reexport modules.
20macro_rules! reexport {
21 ($($name: ident),* $(,)?) => {
22 $( mod $name; )*
23 $( pub use $name::*; )*
24 };
25}
26
27reexport!(block, bracketed, cst, expression, list, name, traits, value);
28
29/// The main pointer used in the [`Cst`]. It's just [`Rc`](std::rc::Rc)
30/// (or [`Arc`](std::sync::Arc) if "async" feature is enabled).
31///
32/// The only reason this type exists is to allow easily switching to other pointer
33/// types, by only editing one line instead of mass refactoring, and without
34/// breaking crates that use it.
35pub type Pointer<T> = PointerInner<T>;
36
37/// An enum representing printing errors that stopped [`Cst::try_print`] from working.
38#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
39#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
40pub enum PrintingError {
41 /// The [`CST`](Cst) has syntax errors.
42 ErroneousCst,
43}