[][src]Struct dtn7::core::peer::DtnPeer

pub struct DtnPeer {
    pub eid: EndpointID,
    pub addr: IpAddr,
    pub con_type: PeerType,
    pub cla_list: Vec<(String, Option<u16>)>,
    pub last_contact: u64,
}

Fields

eid: EndpointIDaddr: IpAddrcon_type: PeerTypecla_list: Vec<(String, Option<u16>)>last_contact: u64

Methods

impl DtnPeer[src]

pub fn new(
    eid: EndpointID,
    addr: IpAddr,
    con_type: PeerType,
    cla_list: Vec<(String, Option<u16>)>
) -> DtnPeer
[src]

pub fn touch(&mut self)[src]

Example

use std::{thread, time};
use dtn7::core::*;
use dtn7::CONFIG;

let mut peer = helpers::rnd_peer();
let original_time = peer.last_contact;
thread::sleep(time::Duration::from_secs(1));
peer.touch();
assert!(original_time < peer.last_contact);

pub fn still_valid(&self) -> bool[src]

Example

use std::{thread, time};
use dtn7::core::*;
use dtn7::CONFIG;

CONFIG.lock().unwrap().peer_timeout = 1;
let mut peer = helpers::rnd_peer();
assert_eq!(peer.still_valid(), true);

thread::sleep(time::Duration::from_secs(2));
assert_eq!(peer.still_valid(), false);

pub fn get_node_name(&self) -> String[src]

pub fn get_first_cla(&self) -> Option<ClaSender>[src]

Trait Implementations

impl Clone for DtnPeer[src]

impl Debug for DtnPeer[src]

impl Serialize for DtnPeer[src]

impl<'de> Deserialize<'de> for DtnPeer[src]

Auto Trait Implementations

impl Send for DtnPeer

impl Sync for DtnPeer

impl Unpin for DtnPeer

impl UnwindSafe for DtnPeer

impl RefUnwindSafe for DtnPeer

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

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

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Err = <U as TryFrom<T>>::Err