pub struct HostId { /* private fields */ }Implementations§
source§impl HostId
impl HostId
sourcepub fn new(key: &Keypair) -> HostId
pub fn new(key: &Keypair) -> HostId
Examples found in repository?
src/local_host.rs (line 47)
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
pub fn new(options: Option<LocalHostOptions>) -> Result<LocalHost, ParseError> {
let mut csprng = OsRng {};
let keypair: Keypair = Keypair::generate(&mut csprng);
let real_options = options.unwrap_or(LocalHostOptions::default());
let mut local_host = LocalHost {
info: HostInfo {
id: HostId::new(&keypair),
name: real_options.name,
description: real_options.description,
urls: Vec::new(),
sig: None,
},
keypair: keypair,
};
local_host.update_urls(&real_options.urls)?; // update_urls will update the sig
Ok(local_host)
}Trait Implementations§
source§impl<'de> Deserialize<'de> for HostId
impl<'de> Deserialize<'de> for HostId
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