pub struct StyleAttr {
pub class: Option<String>,
pub style: Option<String>,
pub id: Option<String>,
}Expand description
Represents SVG style attributes, including optional class, style, and id fields.
StyleAttr is used to conveniently manage and assign SVG styling attributes such as CSS classes,
inline styles, and element IDs. This struct can be used to apply consistent styling to SVG nodes
throughout the plotting library.
Fields§
§class: Option<String>Optional CSS class attribute for the SVG element.
style: Option<String>Optional inline style attribute for the SVG element.
id: Option<String>Optional id attribute for the SVG element.
Implementations§
Source§impl StyleAttr
impl StyleAttr
Sourcepub fn assign<T>(&self, node: &mut T)where
T: Node,
pub fn assign<T>(&self, node: &mut T)where
T: Node,
Assigns the style attributes (class and style) to the given SVG node.
This method sets the class and style attributes on the provided SVG node if they are
present in the StyleAttr instance. If the id is set, it will not be assigned here, as
this method focuses on styling attributes only. If no class or style is set,
this method will not modify the node.
§Arguments * node - A mutable reference to an SVG node that implements the svg::Node
trait.
Trait Implementations§
impl Eq for StyleAttr
impl StructuralPartialEq for StyleAttr
Auto Trait Implementations§
impl Freeze for StyleAttr
impl RefUnwindSafe for StyleAttr
impl Send for StyleAttr
impl Sync for StyleAttr
impl Unpin for StyleAttr
impl UnwindSafe for StyleAttr
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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>
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>
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> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.