Enum rsass::ScopeRef[][src]

pub enum ScopeRef {
    Builtin(&'static Scope),
    Dynamic(Arc<Scope>),
}

A static or dynamic scope referece.

This dereferences to a Scope.

Variants

Builtin(&'static Scope)

The builtin scopes in rsass is static.

Dynamic(Arc<Scope>)

All other scopes are dynamic. This uses Arc reference counting.

Implementations

impl ScopeRef[src]

pub fn new_global(format: Format) -> Self[src]

Create a new global scope.

A “global” scope is just a scope that have no parent. There will be multiple global scopes existing during the evaluation of a single sass file.

pub fn sub(parent: ScopeRef) -> Self[src]

Create a new subscope of a given parent.

pub fn sub_selectors(parent: ScopeRef, selectors: Selectors) -> Self[src]

Create a new subscope of a given parent with selectors.

pub fn is_same(a: &Self, b: &Self) -> bool[src]

Check if a and b references the same scope.

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

Evaluate a body of items in this scope.

Methods from Deref<Target = Scope>

pub fn define_module(&self, name: Name, module: ScopeRef)[src]

Define a module in the scope.

This is used by the @use statement.

pub fn get_module(&self, name: &Name) -> Option<ScopeRef>[src]

Get a module.

This is used when refering to a function or variable with namespace.name notation.

pub fn get_format(&self) -> Format[src]

Get the format used in this scope.

pub fn define(&self, name: Name, val: &Value)[src]

Define a none-default, non-global variable.

pub fn set_variable(&self, name: Name, val: Value, default: bool, global: bool)[src]

Define a variable with a value.

The $ sign is not included in name.

pub fn define_global(&self, name: Name, val: Value)[src]

Define a variable in the global scope that is an ultimate parent of this scope.

pub fn define_multi(&self, names: &[Name], value: &Value)[src]

Define multiple names from a value that is a list. Special case: in names is a single name, value is used directly.

pub fn get_or_none(&self, name: &Name) -> Option<Value>[src]

Get the Value for a variable.

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

Get the value for a variable (or an error).

pub fn store_local_values(&self, names: &[Name]) -> Vec<(Name, Option<Value>)>[src]

Copy a set of local variables to a temporary holder

pub fn restore_local_values(&self, data: Vec<(Name, Option<Value>)>)[src]

Restore a set of local variables from a temporary holder

pub fn get_global_or_none(&self, name: &Name) -> Option<Value>[src]

Get the global Value for a variable.

pub fn get_mixin(&self, name: &Name) -> Option<Mixin>[src]

Get a mixin by name.

Returns the formal args and the body of the mixin.

pub fn define_mixin(&self, name: Name, mixin: Mixin)[src]

Define a mixin.

pub fn define_function(&self, name: Name, func: Function)[src]

Define a function.

pub fn get_function(&self, name: &Name) -> Option<Function>[src]

Get a function by name.

pub fn get_selectors(&self) -> &Selectors[src]

Get the selectors active for this scope.

pub fn expose_star(&self, other: &Scope)[src]

Expose another module directly in this.

This is use other as * behavior.

Trait Implementations

impl Clone for ScopeRef[src]

impl Deref for ScopeRef[src]

type Target = Scope

The resulting type after dereferencing.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> Conv for T

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> TryConv for T

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,