async_openai/types/audio/
impls.rs

1use std::fmt::Display;
2
3use crate::types::audio::{
4    AudioResponseFormat, TimestampGranularity, TranscriptionInclude, TranslationResponseFormat,
5};
6
7impl Display for AudioResponseFormat {
8    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
9        write!(
10            f,
11            "{}",
12            match self {
13                AudioResponseFormat::Json => "json",
14                AudioResponseFormat::Srt => "srt",
15                AudioResponseFormat::Text => "text",
16                AudioResponseFormat::VerboseJson => "verbose_json",
17                AudioResponseFormat::Vtt => "vtt",
18                AudioResponseFormat::DiarizedJson => "diarized_json",
19            }
20        )
21    }
22}
23
24impl Display for TranslationResponseFormat {
25    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
26        write!(
27            f,
28            "{}",
29            match self {
30                TranslationResponseFormat::Json => "json",
31                TranslationResponseFormat::Srt => "srt",
32                TranslationResponseFormat::Text => "text",
33                TranslationResponseFormat::VerboseJson => "verbose_json",
34                TranslationResponseFormat::Vtt => "vtt",
35            }
36        )
37    }
38}
39
40impl Display for TimestampGranularity {
41    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
42        write!(
43            f,
44            "{}",
45            match self {
46                TimestampGranularity::Word => "word",
47                TimestampGranularity::Segment => "segment",
48            }
49        )
50    }
51}
52
53impl Display for TranscriptionInclude {
54    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
55        write!(
56            f,
57            "{}",
58            match self {
59                TranscriptionInclude::Logprobs => "logprobs",
60            }
61        )
62    }
63}