Struct style::rule_tree::StyleSource
source · pub struct StyleSource(ArcUnion<Locked<StyleRule>, Locked<PropertyDeclarationBlock>>);
Expand description
A style source for the rule node. It can either be a CSS style rule or a declaration block.
Note that, even though the declaration block from inside the style rule could be enough to implement the rule tree, keeping the whole rule provides more debuggability, and also the ability of show those selectors to devtools.
Tuple Fields§
§0: ArcUnion<Locked<StyleRule>, Locked<PropertyDeclarationBlock>>
Implementations§
source§impl StyleSource
impl StyleSource
pub(super) fn key(&self) -> NonNull<()>
sourcepub fn from_declarations(decls: Arc<Locked<PropertyDeclarationBlock>>) -> Self
pub fn from_declarations(decls: Arc<Locked<PropertyDeclarationBlock>>) -> Self
Creates a StyleSource from a PropertyDeclarationBlock.
pub(super) fn dump<W: Write>( &self, guard: &SharedRwLockReadGuard<'_>, writer: &mut W, )
sourcepub fn read<'a>(
&'a self,
guard: &'a SharedRwLockReadGuard<'_>,
) -> &'a PropertyDeclarationBlock
pub fn read<'a>( &'a self, guard: &'a SharedRwLockReadGuard<'_>, ) -> &'a PropertyDeclarationBlock
Read the style source guard, and obtain thus read access to the underlying property declaration block.
sourcepub fn as_rule(&self) -> Option<ArcBorrow<'_, Locked<StyleRule>>>
pub fn as_rule(&self) -> Option<ArcBorrow<'_, Locked<StyleRule>>>
Returns the style rule if applicable, otherwise None.
sourcepub fn as_declarations(
&self,
) -> Option<ArcBorrow<'_, Locked<PropertyDeclarationBlock>>>
pub fn as_declarations( &self, ) -> Option<ArcBorrow<'_, Locked<PropertyDeclarationBlock>>>
Returns the declaration block if applicable, otherwise None.
Trait Implementations§
source§impl Clone for StyleSource
impl Clone for StyleSource
source§fn clone(&self) -> StyleSource
fn clone(&self) -> StyleSource
Returns a copy of the value. Read more
1.0.0 · 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 StyleSource
impl Debug for StyleSource
Auto Trait Implementations§
impl Freeze for StyleSource
impl !RefUnwindSafe for StyleSource
impl Send for StyleSource
impl Sync for StyleSource
impl Unpin for StyleSource
impl !UnwindSafe for StyleSource
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 moresource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert