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)
| 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 { |
nothing calls this directly
no outgoing calls
no test coverage detected