Struct bp7::dtntime::CreationTimestamp
source · pub struct CreationTimestamp(/* private fields */);
Expand description
Timestamp when a bundle was created, consisting of the DtnTime and a sequence number.
Implementations§
source§impl CreationTimestamp
impl CreationTimestamp
pub fn new() -> CreationTimestamp
pub fn with_time_and_seq(t: DtnTime, seqno: u64) -> CreationTimestamp
pub fn seqno(&self) -> u64
pub fn dtntime(&self) -> DtnTime
sourcepub fn now() -> CreationTimestamp
pub fn now() -> CreationTimestamp
Create a new timestamp with automatic sequence counting
Example
use bp7::dtntime::*;
use std::{thread, time};
let time1 = CreationTimestamp::now();
let time2 = CreationTimestamp::now();
assert_eq!(time1.dtntime(), time2.dtntime());
assert_ne!(time1.seqno(), time2.seqno());
thread::sleep(time::Duration::from_secs(1));
let time3 = CreationTimestamp::now();
assert_eq!(time3.seqno(), 0);
Trait Implementations§
source§impl Clone for CreationTimestamp
impl Clone for CreationTimestamp
source§fn clone(&self) -> CreationTimestamp
fn clone(&self) -> CreationTimestamp
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for CreationTimestamp
impl Debug for CreationTimestamp
source§impl Default for CreationTimestamp
impl Default for CreationTimestamp
source§fn default() -> CreationTimestamp
fn default() -> CreationTimestamp
Returns the “default value” for a type. Read more
source§impl<'de> Deserialize<'de> for CreationTimestamp
impl<'de> Deserialize<'de> for CreationTimestamp
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Display for CreationTimestamp
impl Display for CreationTimestamp
source§impl PartialEq for CreationTimestamp
impl PartialEq for CreationTimestamp
source§fn eq(&self, other: &CreationTimestamp) -> bool
fn eq(&self, other: &CreationTimestamp) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for CreationTimestamp
impl Serialize for CreationTimestamp
impl StructuralPartialEq for CreationTimestamp
Auto Trait Implementations§
impl RefUnwindSafe for CreationTimestamp
impl Send for CreationTimestamp
impl Sync for CreationTimestamp
impl Unpin for CreationTimestamp
impl UnwindSafe for CreationTimestamp
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