Improved Peer
type, adjusted database
module accordingly. Fixes #18
This commit is contained in:
parent
f2c9fe48a1
commit
4ca9ffaa0e
9 changed files with 53 additions and 30 deletions
|
@ -1,4 +1,3 @@
|
|||
pub mod api;
|
||||
pub mod messages;
|
||||
pub mod peer;
|
||||
pub mod types;
|
||||
|
|
|
@ -22,6 +22,9 @@ pub use message_id::MessageId;
|
|||
mod peer_id;
|
||||
pub use peer_id::PeerId;
|
||||
|
||||
mod peer;
|
||||
pub use peer::Peer;
|
||||
|
||||
mod pot_id;
|
||||
pub use pot_id::PotId;
|
||||
|
||||
|
|
|
@ -5,19 +5,21 @@ use serde::{Deserialize, Serialize};
|
|||
|
||||
use crate::types::PeerId;
|
||||
|
||||
use super::Family;
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
|
||||
pub struct Peer {
|
||||
id: PeerId,
|
||||
name: Option<String>,
|
||||
family: Vec<PeerId>,
|
||||
family: Option<Family>,
|
||||
}
|
||||
|
||||
impl Peer {
|
||||
pub fn new(id: PeerId, name: Option<String>) -> Self {
|
||||
pub fn new(id: PeerId, name: Option<String>, family: Option<Family>) -> Self {
|
||||
Peer {
|
||||
id: id,
|
||||
name: name,
|
||||
family: vec![],
|
||||
id,
|
||||
name,
|
||||
family,
|
||||
}
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue