pub trait Scope {
Show 13 methods
fn define(&mut self, name: &str, val: &Value);
fn define_default(&mut self, name: &str, val: &Value, global: bool);
fn define_global(&self, name: &str, val: &Value);
fn get(&self, name: &str) -> Value;
fn get_global(&self, name: &str) -> Value;
fn define_mixin(&mut self, name: &str, args: &FormalArgs, body: &[Item]);
fn get_mixin(&self, name: &str) -> Option<(FormalArgs, Vec<Item>)>;
fn define_function(&mut self, name: &str, func: SassFunction);
fn get_function(&self, name: &str) -> Option<&SassFunction>;
fn call_function(&self, name: &str, args: &CallArgs) -> Option<Value>;
fn get_selectors(&self) -> &Selectors;
fn define_multi(&mut self, names: &[String], value: &Value) { ... }
fn eval_body(&mut self, body: &[Item]) -> Option<Value>
where
Self: Sized,
{ ... }
}
Expand description
Variables, functions and mixins are defined in a Scope
.
A scope can be a local scope, e.g. in a function, or the global scope. All scopes except the global scope has a parent. The global scope is global to a sass document, multiple different global scopes may exists in the same rust-language process.
Required Methods§
sourcefn define(&mut self, name: &str, val: &Value)
fn define(&mut self, name: &str, val: &Value)
Define a variable with a value.
The $
sign is not included in name
.
fn define_default(&mut self, name: &str, val: &Value, global: bool)
sourcefn define_global(&self, name: &str, val: &Value)
fn define_global(&self, name: &str, val: &Value)
Define a variable in the global scope that is an ultimate parent of this scope.
fn get_global(&self, name: &str) -> Value
fn define_mixin(&mut self, name: &str, args: &FormalArgs, body: &[Item])
fn get_mixin(&self, name: &str) -> Option<(FormalArgs, Vec<Item>)>
fn define_function(&mut self, name: &str, func: SassFunction)
fn get_function(&self, name: &str) -> Option<&SassFunction>
fn call_function(&self, name: &str, args: &CallArgs) -> Option<Value>
fn get_selectors(&self) -> &Selectors
Provided Methods§
sourcefn define_multi(&mut self, names: &[String], value: &Value)
fn define_multi(&mut self, names: &[String], value: &Value)
Define multiple names from a value that is a list. Special case: in names is a single name, value is used directly.