pub struct Cursor {
pub timestamp: u64,
pub message_id: BroadcastMessageID,
}Expand description
A cursor for paginating broadcast messages.
Fields§
§timestamp: u64§message_id: BroadcastMessageIDImplementations§
Source§impl Cursor
impl Cursor
pub fn new(timestamp: u64, message_id: BroadcastMessageID) -> Self
Sourcepub fn go_back_for_some_time(&self, duration: Duration) -> Self
pub fn go_back_for_some_time(&self, duration: Duration) -> Self
Create a new cursor which is the same as the current cursor but with a smaller timestamp. This is useful when we want to query messages back from this cursor for a certain duration.
pub fn to_bytes(&self) -> [u8; 45]
pub fn from_bytes(bytes: &[u8]) -> Result<Self, Error>
Sourcepub fn max() -> Self
pub fn max() -> Self
A dummy cursor with the maximum timestamp and a dummy message id. This is useful when we want to create a cursor after which none of the messages should be included.
pub fn is_max(&self) -> bool
Trait Implementations§
Source§impl Ord for Cursor
impl Ord for Cursor
Source§impl PartialOrd for Cursor
impl PartialOrd for Cursor
impl Eq for Cursor
impl StructuralPartialEq for Cursor
Auto Trait Implementations§
impl !Freeze for Cursor
impl RefUnwindSafe for Cursor
impl Send for Cursor
impl Sync for Cursor
impl Unpin for Cursor
impl UnsafeUnpin for Cursor
impl UnwindSafe for Cursor
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