OutputSubtitleFormat

Enum OutputSubtitleFormat 

Source
pub enum OutputSubtitleFormat {
    Srt,
    Ass,
    Vtt,
    Sub,
}
Expand description

Supported output subtitle formats for conversion operations.

This enum defines all subtitle formats that SubX can generate as output. Each format has specific characteristics and use cases:

  • SRT: Simple, widely supported, good for basic subtitles
  • ASS: Advanced formatting, styling, and positioning capabilities
  • VTT: Web-optimized, supports HTML5 video elements
  • SUB: Frame-based timing, used in some legacy systems

§Format Characteristics

FormatTimingStylingWeb SupportCompatibility
SRTTimeBasicGoodExcellent
ASSTimeRichLimitedGood
VTTTimeMediumExcellentGood
SUBFrameBasicPoorLimited

§Examples

use subx_cli::cli::OutputSubtitleFormat;

let srt_format = OutputSubtitleFormat::Srt;
assert_eq!(srt_format.as_str(), "srt");
assert_eq!(srt_format.file_extension(), ".srt");

Variants§

§

Srt

SubRip (.srt) format - most widely supported subtitle format.

Features:

  • Simple time-based format
  • Basic text formatting (bold, italic, underline)
  • Excellent player compatibility
  • Small file size
§

Ass

Advanced SubStation Alpha (.ass) format - professional subtitle format.

Features:

  • Rich styling and formatting options
  • Precise positioning and animation
  • Multiple font and color support
  • Advanced timing controls
§

Vtt

WebVTT (.vtt) format - web-optimized subtitle format.

Features:

  • HTML5 video element support
  • CSS-like styling capabilities
  • Cue positioning and alignment
  • Web accessibility features
§

Sub

MicroDVD/SubViewer (.sub) format - frame-based subtitle format.

Features:

  • Frame-based timing (not time-based)
  • Basic text formatting
  • Legacy format support
  • Compact file structure

Implementations§

Source§

impl OutputSubtitleFormat

Source

pub fn as_str(&self) -> &'static str

Returns the format identifier as a string.

This method provides the lowercase string representation of the format, which is used for command-line arguments and configuration files.

§Examples
use subx_cli::cli::OutputSubtitleFormat;

assert_eq!(OutputSubtitleFormat::Srt.as_str(), "srt");
assert_eq!(OutputSubtitleFormat::Ass.as_str(), "ass");
assert_eq!(OutputSubtitleFormat::Vtt.as_str(), "vtt");
assert_eq!(OutputSubtitleFormat::Sub.as_str(), "sub");
Source

pub fn file_extension(&self) -> &'static str

Returns the file extension for this format including the dot prefix.

This method provides the standard file extension used for each subtitle format, which is useful for generating output filenames.

§Examples
use subx_cli::cli::OutputSubtitleFormat;

assert_eq!(OutputSubtitleFormat::Srt.file_extension(), ".srt");
assert_eq!(OutputSubtitleFormat::Ass.file_extension(), ".ass");
assert_eq!(OutputSubtitleFormat::Vtt.file_extension(), ".vtt");
assert_eq!(OutputSubtitleFormat::Sub.file_extension(), ".sub");

Trait Implementations§

Source§

impl Clone for OutputSubtitleFormat

Source§

fn clone(&self) -> OutputSubtitleFormat

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 OutputSubtitleFormat

Source§

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

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

impl Display for OutputSubtitleFormat

Source§

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

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

impl PartialEq for OutputSubtitleFormat

Source§

fn eq(&self, other: &OutputSubtitleFormat) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl ValueEnum for OutputSubtitleFormat

Source§

fn value_variants<'a>() -> &'a [Self]

All possible argument values, in display order.
Source§

fn to_possible_value<'a>(&self) -> Option<PossibleValue>

The canonical argument value. Read more
Source§

fn from_str(input: &str, ignore_case: bool) -> Result<Self, String>

Parse an argument into Self.
Source§

impl Eq for OutputSubtitleFormat

Source§

impl StructuralPartialEq for OutputSubtitleFormat

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T> ToStringFallible for T
where T: Display,

Source§

fn try_to_string(&self) -> Result<String, TryReserveError>

ToString::to_string, but without panic on OOM.

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,