pub struct Audio {
pub id: String,
pub url: Option<String>,
pub expires_at: i64,
pub data: String,
}Fields§
§id: String§url: Option<String>模型输出的完整音频文件的URL,有效期24小时。
expires_at: i64url 将要过期的时间戳。
data: String流式输出时的Base64 音频数据。
Implementations§
Source§impl Audio
impl Audio
pub fn get_audio_data(&self) -> String
pub fn is_finished(&self) -> bool
pub fn to_wav( &self, sample_rate: u32, num_channels: u16, bits_per_sample: u16, ) -> Result<Vec<u8>, AudioOutputError>
pub fn bytes(&self) -> Result<Bytes, AudioOutputError>
pub async fn download(&self, save_path: &str) -> Result<(), AudioOutputError>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Audio
impl<'de> Deserialize<'de> for Audio
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
Auto Trait Implementations§
impl Freeze for Audio
impl RefUnwindSafe for Audio
impl Send for Audio
impl Sync for Audio
impl Unpin for Audio
impl UnwindSafe for Audio
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