use crate::pass::{ModelResult, Outcome, PassInfo};
use interoptopus::inventory::PluginInventory;
use interoptopus::pattern::guard::Hash;
#[derive(Default)]
pub struct Config {}
pub struct Pass {
info: PassInfo,
api_hash: u64,
}
impl Pass {
#[must_use]
pub fn new(_: Config) -> Self {
Self { info: PassInfo { name: file!() }, api_hash: 0 }
}
pub fn process(&mut self, _pass_meta: &mut crate::pass::PassMeta, inventory: &PluginInventory) -> ModelResult {
self.api_hash = Hash::from_plugin(inventory).hash();
Ok(Outcome::Unchanged)
}
#[must_use]
pub fn api_hash(&self) -> u64 {
self.api_hash
}
#[must_use]
pub fn api_hash_hex_literal(&self) -> String {
format!("0x{:016X}", self.api_hash)
}
}