pub struct CursorList { pub items: Vec, pub next_cursor: Option, } pub trait AsCursor { fn cursor(&self) -> C; } impl, C> CursorList { pub fn new(items: Vec, limit: usize) -> Self { CursorList { next_cursor: items.get(limit - 1).map(|x| x.cursor()), items, } } }