grass/src/builtin/mod.rs

33 lines
678 B
Rust
Raw Normal View History

2020-01-25 20:58:30 -05:00
use lazy_static::lazy_static;
use std::collections::HashMap;
2020-01-25 20:58:30 -05:00
2020-01-25 23:33:45 -05:00
use crate::args::CallArgs;
use crate::common::Scope;
use crate::error::SassResult;
2020-01-25 20:58:30 -05:00
use crate::value::Value;
2020-02-03 07:11:35 -05:00
#[macro_use]
mod macros;
2020-02-02 22:33:04 -05:00
2020-01-25 23:33:45 -05:00
mod color;
2020-02-02 18:05:36 -05:00
mod list;
mod map;
mod math;
mod meta;
mod selector;
mod string;
2020-01-25 23:33:45 -05:00
pub(crate) type Builtin = Box<dyn Fn(&mut CallArgs, &Scope) -> SassResult<Value> + Send + Sync>;
2020-01-25 20:58:30 -05:00
lazy_static! {
pub(crate) static ref GLOBAL_FUNCTIONS: HashMap<String, Builtin> = {
let mut m = HashMap::new();
2020-01-25 23:33:45 -05:00
color::register(&mut m);
2020-02-14 10:10:51 -05:00
list::register(&mut m);
math::register(&mut m);
2020-02-02 22:33:04 -05:00
meta::register(&mut m);
string::register(&mut m);
2020-01-25 20:58:30 -05:00
m
};
}