[][src]Trait rsass::Scope

pub trait Scope {
    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_or_none(&self, name: &str) -> Option<Value>;
fn get_global_or_none(&self, name: &str) -> Option<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 get(&self, name: &str) -> Result<Value, Error> { ... }
fn get_global(&self, name: &str) -> Result<Value, Error> { ... }
fn eval_body(&mut self, body: &[Item]) -> Result<Option<Value>, Error>
    where
        Self: Sized
, { ... } }

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

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)

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_or_none(&self, name: &str) -> Option<Value>

Get the Value for a variable.

fn get_global_or_none(&self, name: &str) -> Option<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

Loading content...

Provided methods

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.

fn get(&self, name: &str) -> Result<Value, Error>

fn get_global(&self, name: &str) -> Result<Value, Error>

fn eval_body(&mut self, body: &[Item]) -> Result<Option<Value>, Error> where
    Self: Sized

Loading content...

Implementors

impl Scope for GlobalScope[src]

fn define_multi(&mut self, names: &[String], value: &Value)[src]

fn get(&self, name: &str) -> Result<Value, Error>[src]

fn get_global(&self, name: &str) -> Result<Value, Error>[src]

fn eval_body(&mut self, body: &[Item]) -> Result<Option<Value>, Error> where
    Self: Sized
[src]

Loading content...