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!(
28 block, bracketed, cst, expression, list, literals, name, traits, value
29);
30
31/// The main pointer used in the [`Cst`]. It's just [`Rc`](std::rc::Rc)
32/// (or [`Arc`](std::sync::Arc) if "async" feature is enabled). The only reason
33/// this type exists is to allow easily switching to other pointer types, by only
34/// editing one line instead of mass refactoring, and without breaking crates that
35/// use it.
36pub type Pointer<T> = PointerInner<T>;
37
38/// An enum representing printing errors that stopped [`Cst::try_print`] from working.
39#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
40#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
41pub enum PrintingError {
42 /// The [`CST`](Cst) has syntax errors.
43 ErroneousCst,
44}