pub trait Positioner<Item> {
    type Position: Clone + Ord;
    type Checkpoint: Clone;

    // Required methods
    fn position(&self) -> Self::Position;
    fn update(&mut self, token: &Item);
    fn checkpoint(&self) -> Self::Checkpoint;
    fn reset(&mut self, checkpoint: Self::Checkpoint);
}
Expand description

Trait for tracking the current position of a Stream.

Required Associated Types§

source

type Position: Clone + Ord

The type which keeps track of the position

source

type Checkpoint: Clone

Required Methods§

source

fn position(&self) -> Self::Position

Returns the current position

source

fn update(&mut self, token: &Item)

Updates the position given that token has been taken from the stream

source

fn checkpoint(&self) -> Self::Checkpoint

source

fn reset(&mut self, checkpoint: Self::Checkpoint)

Implementations on Foreign Types§

source§

impl<Item, T> Positioner<Item> for &mut T
where Item: Clone, T: ?Sized + Positioner<Item>,

§

type Position = <T as Positioner<Item>>::Position

§

type Checkpoint = <T as Positioner<Item>>::Checkpoint

source§

fn position(&self) -> T::Position

source§

fn update(&mut self, item: &Item)

source§

fn checkpoint(&self) -> Self::Checkpoint

source§

fn reset(&mut self, checkpoint: Self::Checkpoint)

Implementors§