[][src]Struct pubnub_core::data::timetoken::Timetoken

pub struct Timetoken {
    pub t: u64,
    pub r: u32,
}

PubNub Timetoken

This is the timetoken structure that PubNub uses as a stream index. It allows clients to resume streaming from where they left off for added resiliency.

Fields

t: u64

Timetoken

r: u32

Origin region

Methods

impl Timetoken[src]

pub fn new(time: SystemTime, region: u32) -> Result<Self, SystemTimeError>[src]

Create a Timetoken.

Arguments

  • time - A SystemTime representing when the message was received by the PubNub global network.
  • region - An internal region identifier for the originating region.

region may be set to 0 if you have nothing better to use. The combination of a time and region gives us a vector clock that represents the message origin in spacetime; when and where the message was created. Using an appropriate region is important for delivery semantics in a global distributed system.

Errors

Returns an error when the input time argument cannot be transformed into a duration.

Example

use pubnub_core::data::timetoken::Timetoken;
use std::time::SystemTime;

let now = SystemTime::now();
let timetoken = Timetoken::new(now, 0)?;

Trait Implementations

impl Clone for Timetoken[src]

impl Copy for Timetoken[src]

impl Debug for Timetoken[src]

impl Default for Timetoken[src]

impl Display for Timetoken[src]

impl Eq for Timetoken[src]

impl Hash for Timetoken[src]

impl PartialEq<Timetoken> for Timetoken[src]

impl StructuralEq for Timetoken[src]

impl StructuralPartialEq for Timetoken[src]

Auto Trait Implementations

Blanket Implementations

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

impl<T> Any for T where
    T: Any + ?Sized

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,