pub struct PrefetchEngine { /* private fields */ }Expand description
Prefetch engine that generates frame requests based on playhead movement.
Implementations§
Source§impl PrefetchEngine
impl PrefetchEngine
Sourcepub fn new(config: PrefetchConfig, max_position: i64) -> Self
pub fn new(config: PrefetchConfig, max_position: i64) -> Self
Create a new prefetch engine.
Sourcepub fn update(&mut self, new_position: i64) -> Vec<PrefetchRequest>
pub fn update(&mut self, new_position: i64) -> Vec<PrefetchRequest>
Update the playhead position and get new prefetch requests.
Call this every time the playhead moves. Returns a list of positions to prefetch, sorted by priority (most urgent first).
Sourcepub fn mark_cached(&mut self, position: i64)
pub fn mark_cached(&mut self, position: i64)
Mark a position as cached (already decoded).
Sourcepub fn invalidate(&mut self, position: i64)
pub fn invalidate(&mut self, position: i64)
Invalidate a cached position.
Sourcepub fn invalidate_all(&mut self)
pub fn invalidate_all(&mut self)
Invalidate all cached positions.
Sourcepub fn direction(&self) -> PlayDirection
pub fn direction(&self) -> PlayDirection
Get the current detected play direction.
Sourcepub fn cached_count(&self) -> usize
pub fn cached_count(&self) -> usize
Get count of cached/pending positions.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PrefetchEngine
impl RefUnwindSafe for PrefetchEngine
impl Send for PrefetchEngine
impl Sync for PrefetchEngine
impl Unpin for PrefetchEngine
impl UnsafeUnpin for PrefetchEngine
impl UnwindSafe for PrefetchEngine
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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