reticulum-rs 0.1.3

Reticulum-rs is a Rust implementation of the Reticulum Network Stack - a cryptographic, decentralised, and resilient mesh networking protocol designed for communication over any physical layer. This project is open source and community-owned, focused on bringing Reticulum capabilities to the Rust ecosystem with clear APIs, reproducible behavior, and portable deployment options.
Documentation
use std::collections::HashMap;

use crate::hash::AddressHash;
use crate::identity::Identity;

#[derive(Default)]
pub struct Resolver {
    cache: HashMap<AddressHash, Identity>,
}

impl Resolver {
    pub fn new() -> Self {
        Self::default()
    }

    pub fn insert(&mut self, hash: AddressHash, identity: Identity) {
        self.cache.insert(hash, identity);
    }

    pub fn resolve(&self, hash: &AddressHash) -> Option<&Identity> {
        self.cache.get(hash)
    }

    pub fn len(&self) -> usize {
        self.cache.len()
    }

    pub fn is_empty(&self) -> bool {
        self.cache.is_empty()
    }
}