Skip to main content

relay_document_by_nick

Function relay_document_by_nick 

Source
pub fn relay_document_by_nick<D>(
    nick: &str,
    docs: &[RelayDocument<D>],
) -> &'static D
Expand description

Find a particular relay’s document, given the relay’s nickname

This is sound for testdata_live data, because we only have a small curated subset of of relays, all of which have distinct nicks.

§Panics

Panics if no relay with the given name is found.

§Example

use tor_netdoc::doc::microdesc::Microdesc;
use tor_netdoc::testdata_live::{relay_document_by_nick, relay_microdescs};

let _: &'static Microdesc = relay_document_by_nick("lisdex", &relay_microdescs());