Skip to main content

SegmentSelector

Struct SegmentSelector 

Source
pub struct SegmentSelector<'a> { /* private fields */ }
Expand description

A selector over a subset of segments, supporting filtering and operations.

Created via methods on Analysis like pauses(), motion(), etc. Filters can be chained, and terminal operations produce SegmentOps.

Implementations§

Source§

impl<'a> SegmentSelector<'a>

Source

pub fn count(&self) -> usize

Get the number of selected segments.

Source

pub fn is_empty(&self) -> bool

Check if any segments are selected.

Source

pub fn segments(&self) -> &[&'a Segment]

Get the selected segments.

Source

pub fn total_duration_ms(&self) -> u64

Get total duration of selected segments in milliseconds.

Source

pub fn total_frames(&self) -> usize

Get total frame count of selected segments.

Source

pub fn longer_than(self, ms: u32) -> Self

Filter to segments longer than the specified duration.

Source

pub fn shorter_than(self, ms: u32) -> Self

Filter to segments shorter than the specified duration.

Source

pub fn duration_between(self, min_ms: u32, max_ms: u32) -> Self

Filter to segments with duration in the specified range (inclusive).

Source

pub fn frames_gt(self, count: usize) -> Self

Filter to segments with more than N frames.

Source

pub fn frames_lt(self, count: usize) -> Self

Filter to segments with fewer than N frames.

Source

pub fn frames_eq(self, count: usize) -> Self

Filter to segments with exactly N frames.

Source

pub fn filter<F>(self, predicate: F) -> Self
where F: Fn(&Segment) -> bool,

Filter using a custom predicate.

Source

pub fn take(self, n: usize) -> Self

Take only the first N segments.

Source

pub fn skip(self, n: usize) -> Self

Skip the first N segments.

Source

pub fn first(self) -> Self

Take the first segment only.

Source

pub fn last(self) -> Self

Take the last segment only.

Source

pub fn cap(&self, max_ms: u32) -> SegmentOps

Cap duration to a maximum value.

Segments longer than max_ms are collapsed to a single frame with that duration. Shorter segments are unchanged.

Source

pub fn collapse(&self, duration_ms: u32) -> SegmentOps

Collapse each segment to a single frame with the specified duration.

Source

pub fn remove(&self) -> SegmentOps

Remove all selected segments entirely.

Source

pub fn speed_up(&self, factor: f64) -> SegmentOps

Speed up selected segments by a factor.

A factor of 2.0 makes segments play 2x faster (half duration).

Source

pub fn slow_down(&self, factor: f64) -> SegmentOps

Slow down selected segments by a factor.

A factor of 2.0 makes segments play 2x slower (double duration).

Source

pub fn set_duration(&self, ms: u32) -> SegmentOps

Set the total duration for each selected segment.

The duration is distributed evenly across all frames in the segment.

Source

pub fn set_frame_delay(&self, ms: u32) -> SegmentOps

Set a fixed delay for each frame in the selected segments.

Source

pub fn keep(&self) -> SegmentOps

Explicitly keep selected segments unchanged.

This is useful when merging with other operations to ensure certain segments are not modified.

Source

pub fn scale(&self, factor: f64) -> SegmentOps

Scale timing by a raw factor.

Factor < 1.0 speeds up, factor > 1.0 slows down.

Trait Implementations§

Source§

impl<'a> Clone for SegmentSelector<'a>

Source§

fn clone(&self) -> SegmentSelector<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for SegmentSelector<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for SegmentSelector<'a>

§

impl<'a> RefUnwindSafe for SegmentSelector<'a>

§

impl<'a> Send for SegmentSelector<'a>

§

impl<'a> Sync for SegmentSelector<'a>

§

impl<'a> Unpin for SegmentSelector<'a>

§

impl<'a> UnsafeUnpin for SegmentSelector<'a>

§

impl<'a> UnwindSafe for SegmentSelector<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.