pub enum TranscriptionEvent {
Transcription {
chunk_id: usize,
text: String,
},
Error {
chunk_id: usize,
error: String,
},
}Expand description
Events emitted by the transcription service.
These events are sent through the channel returned by TranscriptionService::start
and represent either successful transcriptions or errors that occurred during processing.
§Examples
use vtt_rs::{TranscriptionService, TranscriptionEvent, Config};
let mut service = TranscriptionService::new(config, api_key)?;
let (mut receiver, _stream) = service.start().await?;
while let Some(event) = receiver.recv().await {
match event {
TranscriptionEvent::Transcription { chunk_id, text } => {
if !text.is_empty() {
println!("[{}] {}", chunk_id, text);
}
}
TranscriptionEvent::Error { chunk_id, error } => {
eprintln!("[{}] Error: {}", chunk_id, error);
}
}
}Variants§
Transcription
A successful transcription.
Contains the chunk ID and the transcribed text. An empty string indicates that silence was detected in the audio chunk.
Fields
Error
An error occurred during transcription.
This can happen due to network failures, API errors, or audio processing issues. The chunk ID helps identify which audio segment failed.
Trait Implementations§
Source§impl Clone for TranscriptionEvent
impl Clone for TranscriptionEvent
Source§fn clone(&self) -> TranscriptionEvent
fn clone(&self) -> TranscriptionEvent
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TranscriptionEvent
impl RefUnwindSafe for TranscriptionEvent
impl Send for TranscriptionEvent
impl Sync for TranscriptionEvent
impl Unpin for TranscriptionEvent
impl UnwindSafe for TranscriptionEvent
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more