pub struct ResolverConfig {
pub online_enabled: bool,
pub namespace: Uuid,
pub fuzzy_min_score: Option<f32>,
}Expand description
Configuration for the crate::SimbadResolver facade.
Settings are supplied by the caller at construction; the library persists none of them.
use simbad_resolver::ResolverConfig;
// Namespaced by a fixed, application-specific seed so derived target ids
// stay stable across runs. See `SimbadResolver::new` for its full role.
let config = ResolverConfig::new("my-app.targets").with_fuzzy(0.6);
assert!(config.online_enabled);
assert_eq!(config.fuzzy_min_score, Some(0.6));Fields§
§online_enabled: boolWhether online resolution is attempted on a cache miss. When false,
only the cache is consulted (offline mode).
namespace: UuidThe id namespace used to derive stable target ids from designations.
Supply your own seed via ResolverConfig::new for id continuity.
fuzzy_min_score: Option<f32>Minimum token-set similarity (0.0..=1.0) for a fuzzy typeahead hit in
crate::SimbadResolver::search. None (the default) disables fuzzy
matching; exact/prefix/substring ranking is unaffected either way.
Implementations§
Source§impl ResolverConfig
impl ResolverConfig
Sourcepub fn new(namespace_seed: &str) -> Self
pub fn new(namespace_seed: &str) -> Self
Build a config from an id-namespace seed (e.g. your app’s reverse-DNS name). Online resolution defaults to enabled.
use simbad_resolver::ResolverConfig;
let a = ResolverConfig::new("my-app.targets");
let b = ResolverConfig::new("my-app.targets");
assert!(a.online_enabled);
assert_eq!(a.namespace, b.namespace, "same seed derives the same namespace");Sourcepub fn with_online(self, online_enabled: bool) -> Self
pub fn with_online(self, online_enabled: bool) -> Self
Set whether online resolution is enabled.
use simbad_resolver::ResolverConfig;
let offline = ResolverConfig::new("x").with_online(false);
assert!(!offline.online_enabled);Sourcepub fn with_namespace(self, namespace: Uuid) -> Self
pub fn with_namespace(self, namespace: Uuid) -> Self
Use an explicit namespace UUID (rather than deriving it from a seed).
use simbad_resolver::ResolverConfig;
use uuid::Uuid;
let explicit = Uuid::from_u128(0x1234_5678_90ab_cdef_1234_5678_90ab_cdef);
let config = ResolverConfig::new("x").with_namespace(explicit);
assert_eq!(config.namespace, explicit);Sourcepub fn with_fuzzy(self, min_score: f32) -> Self
pub fn with_fuzzy(self, min_score: f32) -> Self
Enable fuzzy typeahead in crate::SimbadResolver::search: after
exact/prefix/substring matches, remaining result slots are filled with
hits whose token-set similarity to the query is at least min_score
(clamped to 0.0..=1.0), in a crate::RANK_FUZZY tier. Off by default.
Does not affect crate::SimbadResolver::resolve, which stays exact.
use simbad_resolver::ResolverConfig;
let config = ResolverConfig::new("x").with_fuzzy(2.0); // clamped to 1.0
assert_eq!(config.fuzzy_min_score, Some(1.0));