pub struct DeclarationBlock { /* private fields */ }Expand description
The { ... } part of a rule, or an inline style.
Shorthands are expanded when parsed, so this only ever holds longhands. Later declarations of the same longhand win over earlier ones.
Implementations§
Source§impl DeclarationBlock
impl DeclarationBlock
pub fn new() -> Self
Sourcepub fn parse(css: &str) -> Result<Self, Error>
pub fn parse(css: &str) -> Result<Self, Error>
Parses declarations without the surrounding braces, such as
color: red; padding: 4px !important. The first problem is an error.
Sourcepub fn parse_lenient(css: &str) -> (Self, Vec<Error>)
pub fn parse_lenient(css: &str) -> (Self, Vec<Error>)
Like parse, but skips declarations it cannot parse
the way a browser would, and returns the problems alongside.
pub fn push(&mut self, value: PropertyDeclaration, important: bool)
pub fn declarations(&self) -> &[Declaration]
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Clone for DeclarationBlock
impl Clone for DeclarationBlock
Source§fn clone(&self) -> DeclarationBlock
fn clone(&self) -> DeclarationBlock
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DeclarationBlock
impl Debug for DeclarationBlock
Source§impl Default for DeclarationBlock
impl Default for DeclarationBlock
Source§fn default() -> DeclarationBlock
fn default() -> DeclarationBlock
Returns the “default value” for a type. Read more
Source§impl PartialEq for DeclarationBlock
impl PartialEq for DeclarationBlock
Source§fn eq(&self, other: &DeclarationBlock) -> bool
fn eq(&self, other: &DeclarationBlock) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for DeclarationBlock
Auto Trait Implementations§
impl Freeze for DeclarationBlock
impl RefUnwindSafe for DeclarationBlock
impl Send for DeclarationBlock
impl Sync for DeclarationBlock
impl Unpin for DeclarationBlock
impl UnsafeUnpin for DeclarationBlock
impl UnwindSafe for DeclarationBlock
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