StyleBuilder

Struct StyleBuilder 

Source
pub struct StyleBuilder { /* private fields */ }
Expand description

Builder for creating ASS styles with fluent API

Implementations§

Source§

impl StyleBuilder

Source

pub fn new() -> Self

Create a new style builder

Source

pub fn default_style() -> Self

Create a style builder with default values

Source

pub fn name(self, name: &str) -> Self

Set style name

Source

pub fn font(self, font: &str) -> Self

Set font name

Source

pub fn size(self, size: u32) -> Self

Set font size

Source

pub fn color(self, color: &str) -> Self

Set primary text color (in ASS color format)

Source

pub fn bold(self, bold: bool) -> Self

Set bold formatting

Source

pub fn italic(self, italic: bool) -> Self

Set italic formatting

Source

pub fn align(self, alignment: u32) -> Self

Set alignment (1-9, numpad style)

Source

pub fn secondary_color(self, color: &str) -> Self

Set secondary color (for collision effects)

Source

pub fn outline_color(self, color: &str) -> Self

Set outline color

Source

pub fn back_color(self, color: &str) -> Self

Set shadow/background color

Source

pub fn underline(self, underline: bool) -> Self

Set underline formatting

Source

pub fn strikeout(self, strikeout: bool) -> Self

Set strikeout formatting

Source

pub fn scale_x(self, scale: f32) -> Self

Set horizontal scale percentage

Source

pub fn scale_y(self, scale: f32) -> Self

Set vertical scale percentage

Source

pub fn spacing(self, spacing: f32) -> Self

Set character spacing in pixels

Source

pub fn angle(self, angle: f32) -> Self

Set rotation angle in degrees

Source

pub fn border_style(self, style: u32) -> Self

Set border style (1=outline+shadow, 3=opaque box)

Source

pub fn outline(self, width: f32) -> Self

Set outline width in pixels

Source

pub fn shadow(self, depth: f32) -> Self

Set shadow depth in pixels

Source

pub fn margin_left(self, margin: u32) -> Self

Set left margin in pixels

Source

pub fn margin_right(self, margin: u32) -> Self

Set right margin in pixels

Source

pub fn margin_vertical(self, margin: u32) -> Self

Set vertical margin in pixels

Source

pub fn margin_top(self, margin: u32) -> Self

Set top margin in pixels (V4++)

Source

pub fn margin_bottom(self, margin: u32) -> Self

Set bottom margin in pixels (V4++)

Source

pub fn encoding(self, encoding: u32) -> Self

Set font encoding identifier

Source

pub fn alpha_level(self, alpha: u32) -> Self

Set alpha level (SSA v4) - transparency from 0-255 (0=opaque, 255=transparent)

Source

pub fn relative_to(self, relative: &str) -> Self

Set positioning context (V4++)

Source

pub fn build(self) -> Result<String>

Build the style (validates required fields)

Source

pub fn build_with_version(self, version: ScriptVersion) -> Result<String>

Build the style with a specific version format

Source

pub fn build_with_format(&self, format: &[&str]) -> Result<String>

Build the style with a specific format line The format parameter should contain field names like [“Name”, “Fontname”, “Fontsize”, …]

Trait Implementations§

Source§

impl Clone for StyleBuilder

Source§

fn clone(&self) -> StyleBuilder

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for StyleBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for StyleBuilder

Source§

fn default() -> StyleBuilder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.