pub struct Stylesheet {
origin: Origin,
qualified_rules: Vec<QualifiedRule>,
}Expand description
A parsed CSS stylesheet.
Fields§
§origin: Origin§qualified_rules: Vec<QualifiedRule>Implementations§
Source§impl Stylesheet
impl Stylesheet
fn empty(origin: Origin) -> Stylesheet
Sourcepub fn from_data(
buf: &str,
url_resolver: &UrlResolver,
origin: Origin,
session: Session,
) -> Result<Self, LoadingError>
pub fn from_data( buf: &str, url_resolver: &UrlResolver, origin: Origin, session: Session, ) -> Result<Self, LoadingError>
Parses a new stylesheet from CSS data in a string.
The url_resolver_url is required for @import rules, so that librsvg can determine if
the requested path is allowed.
Sourcepub fn from_href(
aurl: &AllowedUrl,
origin: Origin,
session: Session,
) -> Result<Self, LoadingError>
pub fn from_href( aurl: &AllowedUrl, origin: Origin, session: Session, ) -> Result<Self, LoadingError>
Parses a new stylesheet by loading CSS data from a URL.
Sourcefn add_rules_from_string(
&mut self,
buf: &str,
url_resolver: &UrlResolver,
session: Session,
) -> Result<(), LoadingError>
fn add_rules_from_string( &mut self, buf: &str, url_resolver: &UrlResolver, session: Session, ) -> Result<(), LoadingError>
Parses the CSS rules in buf and appends them to the stylesheet.
The url_resolver_url is required for @import rules, so that librsvg can determine if
the requested path is allowed.
If there is an @import rule, its rules will be recursively added into the
stylesheet, in the order in which they appear.
Sourcefn load(
&mut self,
aurl: &AllowedUrl,
session: Session,
) -> Result<(), LoadingError>
fn load( &mut self, aurl: &AllowedUrl, session: Session, ) -> Result<(), LoadingError>
Parses a stylesheet referenced by an URL
Auto Trait Implementations§
impl Freeze for Stylesheet
impl RefUnwindSafe for Stylesheet
impl Send for Stylesheet
impl Sync for Stylesheet
impl Unpin for Stylesheet
impl UnwindSafe for Stylesheet
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.