Skip to main content

ParserOptions

Struct ParserOptions 

Source
pub struct ParserOptions {
Show 52 fields pub minify: Option<bool>, pub minify_ast: Option<bool>, pub parse_color: Option<bool>, pub nesting_rules: Option<bool>, pub remove_duplicate_declarations: Option<RemoveDuplicateDeclarations>, pub compute_shorthand: Option<bool>, pub compute_transform: Option<bool>, pub compute_calc_expression: Option<bool>, pub inline_css_variables: Option<bool>, pub evaluate_mixins: Option<bool>, pub keep_mixins: Option<bool>, pub remove_empty: Option<bool>, pub remove_prefix: Option<bool>, pub optimize_selectors: Option<bool>, pub merge_rules: Option<u32>, pub fast_mode: Option<bool>, pub pass: Option<u32>, pub sourcemap: Option<SourceMapOption>, pub input_source_map: Option<String>, pub nested_rule: Option<bool>, pub validation: Option<bool>, pub lenient: Option<bool>, pub sync_api_compat: bool, pub is_optional: Option<bool>, pub is_repeatable: Option<bool>, pub is_list: Option<bool>, pub occurrence: Option<bool>, pub at_least_once: Option<bool>, pub sources_map: Option<SourcesMap>, pub source: Option<Rc<SourceFile>>, pub src: Option<String>, pub remove_charset: Option<bool>, pub cwd: Option<String>, pub expand_nesting_rules: Option<bool>, pub expand_if_syntax: Option<bool>, pub resolve_urls: Option<bool>, pub set_parent: Option<bool>, pub module: Option<ModuleOption>, pub resolve_import: Option<bool>, pub visitor: Option<Rc<HostDef>>, pub load: Option<u32>, pub stream: Option<u32>, pub stream_size: Option<usize>, pub minify_values: Option<bool>, pub beautify: Option<bool>, pub preserve_license: Option<bool>, pub indent: Option<String>, pub new_line: Option<String>, pub remove_comments: Option<bool>, pub convert_color: Option<ConvertColor>, pub with_parents: Option<bool>, pub output: Option<String>,
}
Expand description

parser, validation and minification options

Fields§

§minify: Option<bool>§minify_ast: Option<bool>§parse_color: Option<bool>§nesting_rules: Option<bool>§remove_duplicate_declarations: Option<RemoveDuplicateDeclarations>§compute_shorthand: Option<bool>§compute_transform: Option<bool>§compute_calc_expression: Option<bool>§inline_css_variables: Option<bool>§evaluate_mixins: Option<bool>§keep_mixins: Option<bool>§remove_empty: Option<bool>§remove_prefix: Option<bool>§optimize_selectors: Option<bool>

optimize the selectors (reduce, factor with :is()): None is true

§merge_rules: Option<u32>

mergeRules?: boolean | MergeRulesEnum: a MergeRulesEnum value (true is All, false is None). None (unset): All when the ast is minified, no merge otherwise

§fast_mode: Option<bool>

the inexpensive minifications only: sets the default value of the fast mode settings (see with_defaults())

§pass: Option<u32>§sourcemap: Option<SourceMapOption>§input_source_map: Option<String>§nested_rule: Option<bool>§validation: Option<bool>§lenient: Option<bool>§sync_api_compat: bool

the restrictions of the typescript parseSync() / transformSync(), set by the javascript bindings only: the @import rules are not resolved, the visitor results are not awaited, a css variable import or a composes from a file is an error, the scoped names are generated by generateSyncScopedName(). the rust api has no restriction: do_parse() and do_parse_sync() provide every feature

§is_optional: Option<bool>§is_repeatable: Option<bool>§is_list: Option<bool>§occurrence: Option<bool>§at_least_once: Option<bool>§sources_map: Option<SourcesMap>§source: Option<Rc<SourceFile>>§src: Option<String>§remove_charset: Option<bool>§cwd: Option<String>§expand_nesting_rules: Option<bool>§expand_if_syntax: Option<bool>§resolve_urls: Option<bool>§set_parent: Option<bool>§module: Option<ModuleOption>§resolve_import: Option<bool>§visitor: Option<Rc<HostDef>>

visitor maps (visitor), with the functions replaced by host callback ids

§load: Option<u32>

host callback id of load

§stream: Option<u32>

host callback id of the reader of a stream input: it returns the next chunk (bytes or text), null at the end of the stream. the bindings set it when the input is a ReadableStream

§stream_size: Option<usize>

the size of the css of the stream, in bytes, when it is known (a file, a response with a content length): the code units and the arena are allocated once. 0: not known

§minify_values: Option<bool>§beautify: Option<bool>§preserve_license: Option<bool>§indent: Option<String>§new_line: Option<String>§remove_comments: Option<bool>§convert_color: Option<ConvertColor>§with_parents: Option<bool>§output: Option<String>

Implementations§

Source§

impl ParserOptions

Source

pub fn is(&self, value: Option<bool>) -> bool

Source

pub fn validation(&self) -> bool

options.validation is truthy

Source§

impl ParserOptions

Source

pub fn from_host(def: &HostDef) -> ParserOptions

the options of a javascript options object. the keys are the typescript option names; undefined and null values are absent options. the functions are host callbacks

Trait Implementations§

Source§

impl Clone for ParserOptions

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for ParserOptions

Source§

fn default() -> Self

Returns the “default value” for a type. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.