grass/src/builtin/mod.rs

32 lines
659 B
Rust
Raw Normal View History

use once_cell::sync::Lazy;
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::error::SassResult;
use crate::scope::Scope;
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
2020-04-02 13:45:14 -04:00
pub(crate) type Builtin = Box<dyn Fn(CallArgs, &Scope) -> SassResult<Value> + Send + Sync>;
2020-01-25 20:58:30 -05:00
pub(crate) static GLOBAL_FUNCTIONS: Lazy<HashMap<String, Builtin>> = Lazy::new(|| {
let mut m = HashMap::new();
color::register(&mut m);
list::register(&mut m);
2020-03-30 15:43:15 -04:00
map::register(&mut m);
math::register(&mut m);
meta::register(&mut m);
string::register(&mut m);
m
});