pub struct FetchedTranscriptSnippet {
pub text: String,
pub start: f64,
pub duration: f64,
}
Expand description
§FetchedTranscriptSnippet
Represents a single segment of transcript text with its timing information.
YouTube transcripts are divided into discrete text segments, each with a specific start time and duration. This struct captures one such segment.
§Fields
text
- The actual transcript text for this segmentstart
- The timestamp when this text appears (in seconds)duration
- How long this text stays on screen (in seconds)
§Notes
- Transcript segments may overlap in time
- The
text
may include HTML formatting if formatting preservation is enabled - Time values are floating point to allow for sub-second precision
§Example Usage
let snippet = FetchedTranscriptSnippet {
text: "Hello, world!".to_string(),
start: 5.2,
duration: 2.5,
};
println!("[{:.1}s-{:.1}s]: {}",
snippet.start,
snippet.start + snippet.duration,
snippet.text);
// Outputs: [5.2s-7.7s]: Hello, world!
Fields§
§text: String
The text content of this snippet
start: f64
The timestamp at which this snippet appears on screen in seconds
duration: f64
The duration of how long the snippet stays on screen in seconds. Note that there can be overlaps between snippets
Trait Implementations§
Source§impl Clone for FetchedTranscriptSnippet
impl Clone for FetchedTranscriptSnippet
Source§fn clone(&self) -> FetchedTranscriptSnippet
fn clone(&self) -> FetchedTranscriptSnippet
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for FetchedTranscriptSnippet
impl Debug for FetchedTranscriptSnippet
Source§impl<'de> Deserialize<'de> for FetchedTranscriptSnippet
impl<'de> Deserialize<'de> for FetchedTranscriptSnippet
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 FetchedTranscriptSnippet
impl RefUnwindSafe for FetchedTranscriptSnippet
impl Send for FetchedTranscriptSnippet
impl Sync for FetchedTranscriptSnippet
impl Unpin for FetchedTranscriptSnippet
impl UnwindSafe for FetchedTranscriptSnippet
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