use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct TranscriptionWord {
#[serde(rename = "word")]
pub word: String,
#[serde(rename = "start")]
pub start: f32,
#[serde(rename = "end")]
pub end: f32,
}
impl TranscriptionWord {
pub fn new(word: String, start: f32, end: f32) -> TranscriptionWord {
TranscriptionWord { word, start, end }
}
}
impl std::fmt::Display for TranscriptionWord {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match serde_json::to_string(self) {
Ok(s) => write!(f, "{}", s),
Err(_) => Err(std::fmt::Error),
}
}
}