Struct css::Stylesheet
[−]
[src]
pub struct Stylesheet { pub rules: CssRules, pub source_map_url: Option<String>, pub source_url: Option<String>, }
Represents an entire CSS stylesheet. The values of property declarations are currently stored as a string. Parsing property declarations is a monster job. If you feel like helping...
Fields
rules: CssRules
The stylesheet's rules.
source_map_url: Option<String>
An optional source map for this stylesheet.
source_url: Option<String>
An optional source URL for this stylesheet.
Methods
impl Stylesheet
[src]
fn to_file_path<P: AsRef<Path>>(
&self,
stylesheet_file_path: P,
include_source_urls: bool
) -> Result<(), StylesheetError>
[src]
&self,
stylesheet_file_path: P,
include_source_urls: bool
) -> Result<(), StylesheetError>
Serializes a Stylesheet to a file path, optionally including source-map and source-url comments.
Will create or truncate stylesheet_file_path
as required.
Convenience method wrapped to_css()
.
fn to_css_string(&self, include_source_urls: bool) -> String
[src]
Serializes a Stylesheet as a string, optionally including source-map and source-url comments.
Convenience method wrapped to_css()
.
fn to_bytes(&self, include_source_urls: bool) -> Vec<u8>
[src]
Serializes a Stylesheet to a vector of UTF-8 encoded bytes.
Convenience method wrapped to_css_string()
.
fn to_css<W: Write>(
&self,
destination: &mut W,
include_source_urls: bool
) -> Result
[src]
&self,
destination: &mut W,
include_source_urls: bool
) -> Result
Serializes a Stylesheet, optionally including source-map and source-url comments.
fn from_file_path<P: AsRef<Path>>(
html_document_file_path: P
) -> Result<Self, StylesheetError>
[src]
html_document_file_path: P
) -> Result<Self, StylesheetError>
Loads and parses a Stylesheet.
fn parse<'i>(
css: &'i str
) -> Result<Self, PreciseParseError<'i, CustomParseError<'i>>>
[src]
css: &'i str
) -> Result<Self, PreciseParseError<'i, CustomParseError<'i>>>
Parses a string of CSS to produce a stylesheet. Can be used with the contents of a CSS file. Assumes the string is UTF-8 encoded. Does not use a stream of bytes as parsing CSS involves going backwards and forwards a lot... CSS parsing is somewhat evil and is not particularly efficient. The parser does apply a few small modifications to the incoming CSS, normalizing some pseudo-class, psuedo-element and media query names. The parser does not parse properties as such, simply keeping them as a CSS string. Hopefully it will one day - there are only 200 odd specialist rules to implement.
Trait Implementations
impl Debug for Stylesheet
[src]
impl Clone for Stylesheet
[src]
fn clone(&self) -> Stylesheet
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more