Struct scribl_curves::Cursor[][src]

pub struct Cursor<T: Ord + Copy, Id: Copy + Eq> { /* fields omitted */ }

A cursor allows for efficiently scanning through a collection of overlapping intervals (which we call "spans"). It is optimized for the case where you need to repeatedly move the current position by a little bit in either direction; in this case, the complexity is O(n), where n is the number of "active" spans that overlap the times you're interested in.

Implementations

impl Cursor<Time, DrawSnippetId>[src]

pub fn bboxes<'a, 'b: 'a, 'c: 'a>(
    &'b self,
    snippets: &'c DrawSnippets
) -> impl Iterator<Item = Rect> + 'a
[src]

impl<T: Ord + Copy, Id: Copy + Eq> Cursor<T, Id>[src]

pub fn new<I: IntoIterator<Item = Span<T, Id>>>(
    spans: I,
    start_time: T,
    end_time: T
) -> Cursor<T, Id>
[src]

Creates a new cursor for the given set of spans, and initializes its current position to be the interval [start_time, end_time] (inclusive of both ends).

pub fn empty(time: T) -> Cursor<T, Id>[src]

Creates a cursor with no spans, set to the time interval [time, time].

pub fn current(&self) -> (T, T)[src]

Returns this cursors current time interval.

pub fn advance_to(&mut self, start_time: T, end_time: T)[src]

pub fn active_ids<'a>(&'a self) -> impl Iterator<Item = Id> + 'a[src]

pub fn active_spans<'a>(&'a self) -> impl Iterator<Item = Span<T, Id>> + 'a[src]

pub fn is_finished(&self) -> bool[src]

Trait Implementations

impl<T: Debug + Ord + Copy, Id: Debug + Copy + Eq> Debug for Cursor<T, Id>[src]

Auto Trait Implementations

impl<T, Id> RefUnwindSafe for Cursor<T, Id> where
    Id: RefUnwindSafe,
    T: RefUnwindSafe
[src]

impl<T, Id> Send for Cursor<T, Id> where
    Id: Send,
    T: Send
[src]

impl<T, Id> Sync for Cursor<T, Id> where
    Id: Sync,
    T: Sync
[src]

impl<T, Id> Unpin for Cursor<T, Id> where
    Id: Unpin,
    T: Unpin
[src]

impl<T, Id> UnwindSafe for Cursor<T, Id> where
    Id: UnwindSafe,
    T: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> RoundFrom<T> for T

impl<T, U> RoundInto<U> for T where
    U: RoundFrom<T>, 

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.