link-cli 0.2.6

A CLI tool and reusable library for links manipulation backed by a LiNo-notation doublet storage engine.
Documentation
use crate::link_storage::LinkStorage;

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub struct TargetMatcher {
    target: u32,
}

impl TargetMatcher {
    pub fn new(target: u32) -> Self {
        Self { target }
    }

    pub fn target(&self) -> u32 {
        self.target
    }

    pub fn is_matched(&self, links: &LinkStorage, link: u32) -> bool {
        links
            .get(link)
            .is_some_and(|candidate| candidate.target == self.target)
    }
}