pub struct SegmentRing { /* private fields */ }Expand description
Bounded ring buffer for completed segments.
Implementations§
Source§impl SegmentRing
impl SegmentRing
pub fn new(max_segments: usize) -> Self
Sourcepub fn with_retention(
playlist_segments: usize,
retained_segments: usize,
) -> Self
pub fn with_retention( playlist_segments: usize, retained_segments: usize, ) -> Self
playlist_segments is the advertised window; retained_segments
(at least the window) is kept for late segment requests.
Sourcepub fn snapshot(&self) -> Vec<Segment>
pub fn snapshot(&self) -> Vec<Segment>
Get a snapshot of all segments (for playlist generation).
Sourcepub fn latest_sequence(&self) -> Option<u64>
pub fn latest_sequence(&self) -> Option<u64>
Sequence number of the newest segment.
Blocking playlist reloads only need the edge, not a cloned window:
snapshot() clones every retained segment and sorts it.
Sourcepub fn latest_init(&self) -> Option<Bytes>
pub fn latest_init(&self) -> Option<Bytes>
Get the latest init segment data.
pub fn is_empty(&self) -> bool
Auto Trait Implementations§
impl !Freeze for SegmentRing
impl Forget for SegmentRing
impl Move for SegmentRing
impl RefUnwindSafe for SegmentRing
impl Send for SegmentRing
impl Sync for SegmentRing
impl Unpin for SegmentRing
impl UnsafeUnpin for SegmentRingwhere
Align4<u32>: UnsafeUnpin,
Align1<u8>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<Segment>: UnsafeUnpin,
Align8<usize>: UnsafeUnpin,
*const Waiter is !null: UnsafeUnpin,
impl UnwindSafe for SegmentRing
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