MCPcopy Create free account
hub / github.com/base/base / enabled

Method enabled

crates/builder/core/src/shadow_validity.rs:45–52  ·  view source on GitHub ↗

Enables shadow validity injection at the supplied basis-point sampling rate. # Errors Returns an error when the rate is zero or greater than 100%.

(sample_rate_basis_points: u16)

Source from the content-addressed store, hash-verified

43 ///
44 /// Returns an error when the rate is zero or greater than 100%.
45 pub const fn enabled(sample_rate_basis_points: u16) -> Result<Self, ShadowValidityConfigError> {
46 if sample_rate_basis_points == 0
47 || sample_rate_basis_points > MAX_SHADOW_VALIDITY_SAMPLE_RATE_BPS
48 {
49 return Err(ShadowValidityConfigError::InvalidSampleRate);
50 }
51 Ok(Self { enabled: true, sample_rate_basis_points })
52 }
53
54 /// Returns whether injection is enabled.
55 pub const fn is_enabled(self) -> bool {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected