Struct bp7::dtntime::CreationTimestamp
source · [−]pub struct CreationTimestamp(_, _);
Expand description
Timestamp when a bundle was created, consisting of the DtnTime and a sequence number.
Implementations
sourceimpl 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
sourceimpl Clone for CreationTimestamp
impl Clone for CreationTimestamp
sourcefn clone(&self) -> CreationTimestamp
fn clone(&self) -> CreationTimestamp
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for CreationTimestamp
impl Debug for CreationTimestamp
sourceimpl Default for CreationTimestamp
impl Default for CreationTimestamp
sourcefn default() -> CreationTimestamp
fn default() -> CreationTimestamp
Returns the “default value” for a type. Read more
sourceimpl<'de> Deserialize<'de> for CreationTimestamp
impl<'de> Deserialize<'de> for CreationTimestamp
sourcefn 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
sourceimpl Display for CreationTimestamp
impl Display for CreationTimestamp
sourceimpl PartialEq<CreationTimestamp> for CreationTimestamp
impl PartialEq<CreationTimestamp> for CreationTimestamp
sourcefn 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 ==
. Read more
sourcefn ne(&self, other: &CreationTimestamp) -> bool
fn ne(&self, other: &CreationTimestamp) -> bool
This method tests for !=
.
sourceimpl 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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more