sass_alt/SassCompiler.rs
1// This file is part of sass-alt. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/sass-alt/master/COPYRIGHT. No part of predicator, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the COPYRIGHT file.
2// Copyright © 2017 The developers of sass-alt. See the COPYRIGHT file in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/sass-alt/master/COPYRIGHT.
3
4
5/// A Wrapper around the Sass_Compiler object to make it easier to use correctly.
6#[derive(Debug, Copy, Clone)]
7pub struct SassCompiler(*mut Sass_Compiler);
8
9impl SassCompiler
10{
11 /// Get Sass_Context object.
12 #[inline(always)]
13 pub fn context(&self) -> *mut Sass_Context
14 {
15 self.0.get_context()
16 }
17
18 /// Get Sass_Options object.
19 #[inline(always)]
20 pub fn get_options(&self) -> *mut Sass_Options
21 {
22 self.0.get_options()
23 }
24
25 /// Get compiler state object.
26 #[inline(always)]
27 pub fn get_state(&self) -> Sass_Compiler_State
28 {
29 self.0.get_state()
30 }
31
32 /// Iterate over imports.
33 /// Iterator also provides a specific `last_import()` method for convenience.
34 #[inline(always)]
35 pub fn iter_imports(&self) -> ImportsSassCompilerIterator
36 {
37 ImportsSassCompilerIterator::new(self.0)
38 }
39
40 /// Iterate over callees.
41 /// Iterator also provides a specific `last_callee()` method for convenience.
42 #[inline(always)]
43 pub fn iter_callees(&self) -> CalleesSassCompilerIterator
44 {
45 CalleesSassCompilerIterator::new(self.0)
46 }
47}