pub struct StreamInstant(pub u64);Expand description
Represents a point in stream time, anchored to estimated playback position.
StreamInstant represents the estimated playback time of points, not merely
“points sent so far.” When used in ChunkRequest::start, it represents:
start = playhead + buffered
Where:
playhead= stream_epoch + estimated_consumed_pointsbuffered= points sent but not yet played
This allows callbacks to generate content for the exact time it will be displayed, enabling accurate audio synchronization.
Tuple Fields§
§0: u64Implementations§
Source§impl StreamInstant
impl StreamInstant
Sourcepub fn as_seconds(&self, pps: u32) -> f64
pub fn as_seconds(&self, pps: u32) -> f64
Convert this instant to seconds at the given points-per-second rate.
Sourcepub fn as_secs_f64(&self, pps: u32) -> f64
pub fn as_secs_f64(&self, pps: u32) -> f64
Convert to seconds at the given PPS.
This is an alias for as_seconds() for consistency with standard Rust
duration naming conventions (e.g., Duration::as_secs_f64()).
Sourcepub fn from_seconds(seconds: f64, pps: u32) -> Self
pub fn from_seconds(seconds: f64, pps: u32) -> Self
Create a stream instant from a duration in seconds at the given PPS.
Sourcepub fn add_points(&self, points: u64) -> Self
pub fn add_points(&self, points: u64) -> Self
Add a number of points to this instant.
Sourcepub fn sub_points(&self, points: u64) -> Self
pub fn sub_points(&self, points: u64) -> Self
Subtract a number of points from this instant (saturating at 0).
Trait Implementations§
Source§impl Add<u64> for StreamInstant
impl Add<u64> for StreamInstant
Source§impl AddAssign<u64> for StreamInstant
impl AddAssign<u64> for StreamInstant
Source§fn add_assign(&mut self, rhs: u64)
fn add_assign(&mut self, rhs: u64)
+= operation. Read moreSource§impl Clone for StreamInstant
impl Clone for StreamInstant
Source§fn clone(&self) -> StreamInstant
fn clone(&self) -> StreamInstant
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StreamInstant
impl Debug for StreamInstant
Source§impl Default for StreamInstant
impl Default for StreamInstant
Source§fn default() -> StreamInstant
fn default() -> StreamInstant
Source§impl Hash for StreamInstant
impl Hash for StreamInstant
Source§impl Ord for StreamInstant
impl Ord for StreamInstant
Source§fn cmp(&self, other: &StreamInstant) -> Ordering
fn cmp(&self, other: &StreamInstant) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for StreamInstant
impl PartialEq for StreamInstant
Source§impl PartialOrd for StreamInstant
impl PartialOrd for StreamInstant
Source§impl Sub<u64> for StreamInstant
impl Sub<u64> for StreamInstant
Source§impl SubAssign<u64> for StreamInstant
impl SubAssign<u64> for StreamInstant
Source§fn sub_assign(&mut self, rhs: u64)
fn sub_assign(&mut self, rhs: u64)
-= operation. Read more