pub struct TextStyle {
pub name: String,
pub declarations: String,
}Expand description
A CSS class declared by a timeline for use by its rich-text clips.
Fields§
§name: StringClass name, as referenced by class="..." in a clip’s Title HTML.
A plain CSS identifier: [A-Za-z_-][A-Za-z0-9_-]*, not starting with
a digit or with - followed by a digit. Case-sensitive, like CSS.
declarations: StringThe CSS declaration block of the class, without the surrounding
braces: font-size:56px;color:#fff.
Implementations§
Source§impl TextStyle
impl TextStyle
Sourcepub fn new(name: impl Into<String>, declarations: impl Into<String>) -> Self
pub fn new(name: impl Into<String>, declarations: impl Into<String>) -> Self
A style with the given class name and declaration block.
Sourcepub fn normalized(&self) -> Option<TextStyle>
pub fn normalized(&self) -> Option<TextStyle>
This style with name and declarations trimmed. None when the player
would ignore the style: a name that is not a plain CSS identifier, or
a declaration block that is empty or contains { or }.
Sourcepub fn is_valid(&self) -> bool
pub fn is_valid(&self) -> bool
Whether this style would be kept by TextStyle::normalized.
Sourcepub fn to_css_rule(&self) -> String
pub fn to_css_rule(&self) -> String
The CSS rule the player injects for this style: .name { declarations }.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TextStyle
impl<'de> Deserialize<'de> for TextStyle
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for TextStyle
impl StructuralPartialEq for TextStyle
Auto Trait Implementations§
impl Freeze for TextStyle
impl RefUnwindSafe for TextStyle
impl Send for TextStyle
impl Sync for TextStyle
impl Unpin for TextStyle
impl UnsafeUnpin for TextStyle
impl UnwindSafe for TextStyle
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