cairo_lang_plugins/
lib.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//! Cairo core plugin implementations.
use std::sync::Arc;

use cairo_lang_defs::plugin::MacroPlugin;

use crate::plugins::{
    CompileErrorPlugin, ConfigPlugin, DerivePlugin, GenerateTraitPlugin, PanicablePlugin,
};

pub mod plugins;
#[cfg(any(feature = "testing", test))]
pub mod test_utils;

#[cfg(test)]
mod test;

/// Gets the base macro plugins to load into the Cairo compiler.
pub fn get_base_plugins() -> Vec<Arc<dyn MacroPlugin>> {
    // Config plugin should be first, as it removes items from the AST, and other plugins may
    // add items prior to the removal of the original.
    vec![
        Arc::new(ConfigPlugin::default()),
        Arc::new(DerivePlugin::default()),
        Arc::new(GenerateTraitPlugin::default()),
        Arc::new(PanicablePlugin::default()),
        Arc::new(CompileErrorPlugin::default()),
    ]
}