pub struct ObsCallsite { /* private fields */ }Expand description
Static metadata for a single emit site. Constructed by codegen via
the const fn constructor — no heap allocation, no first-emit cost.
See spec 11 § 2.
Implementations§
Source§impl ObsCallsite
impl ObsCallsite
Sourcepub const fn new(
full_name: &'static str,
default_sev: Severity,
module: &'static str,
file: &'static str,
line: u32,
) -> Self
pub const fn new( full_name: &'static str, default_sev: Severity, module: &'static str, file: &'static str, line: u32, ) -> Self
Construct a callsite. Intended for use by codegen at static init; the const-fn shape means no heap allocation on first emit.
Sourcepub fn enabled(&self, current_gen: u32) -> EnabledOutcome
pub fn enabled(&self, current_gen: u32) -> EnabledOutcome
Hot-path enabled check.
Returns true if this callsite might fire (Sometimes /
Always); the caller is then expected to invoke
Observer::enabled only when the result is Sometimes.
current_gen is the observer’s generation(). On a generation
mismatch the cache is reset to Unknown and the caller re-probes.
Sourcepub fn cache(&self, interest: Interest, current_gen: u32)
pub fn cache(&self, interest: Interest, current_gen: u32)
Update the cached interest after probing the observer.
Sourcepub fn reset_cache(&self)
pub fn reset_cache(&self)
Force the cache to Unknown so the next emit re-probes. Used by
tests; production reload uses ObsCallsite::cache with the new
generation, which has the same effect.
Sourcepub const fn default_sev(&self) -> Severity
pub const fn default_sev(&self) -> Severity
Default severity declared by the schema.