Struct Embedded

Source
pub struct Embedded { /* private fields */ }
Expand description

The sass-embedded compiler for rust host.

Implementations§

Source§

impl Embedded

Source

pub fn new(exe_path: impl AsRef<OsStr>) -> Result<Self>

Creates a sass-embedded compiler and connects with the dart-sass-embedded.

let mut sass = sass_embedded::Sass::new("path/to/sass_embedded").unwrap();
Source

pub fn compile( &mut self, path: impl AsRef<Path>, options: Options, ) -> Result<CompileResult>

Compiles the Sass file at path to CSS. If it succeeds it returns a CompileResult, and if it fails it throws an [Exception].

use sass_embedded::{Sass, Options};

let mut sass = Sass::new("path/to/sass_embedded").unwrap();
let res = sass.compile("../styles/a.scss", Options::default()).unwrap();

More information: Sass documentation

Source

pub fn compile_string( &mut self, source: impl Into<String>, options: StringOptions, ) -> Result<CompileResult>

Compiles a stylesheet whose contents is source to CSS. If it succeeds it returns a CompileResult, and if it fails it throws an [Exception].

use sass_embedded::{Sass, StringOptions};

let mut sass = Sass::new("path/to/sass_embedded").unwrap();
let res = sass.compile_string("a {b: c}", StringOptions::default()).unwrap();

More information: Sass documentation

Source

pub fn info(&mut self) -> Result<String>

Gets the version of the sass-embedded compiler.

Source§

impl Embedded

Source

pub fn render(&mut self, options: LegacyOptions) -> Result<LegacyResult>

More information: Sass documentation

Trait Implementations§

Source§

impl Debug for Embedded

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T