nimbus/
lib.rs

1// This Source Code Form is subject to the terms of the Mozilla Public
2// License, v. 2.0. If a copy of the MPL was not distributed with this
3// file, You can obtain one at https://mozilla.org/MPL/2.0/.
4
5mod defaults;
6mod enrollment;
7mod evaluator;
8mod json;
9mod sampling;
10mod strings;
11mod targeting;
12
13pub mod error;
14pub mod metrics;
15pub mod schema;
16
17pub use crate::enrollment::{EnrolledFeature, EnrollmentStatus};
18pub use crate::error::{NimbusError, Result};
19#[cfg(debug_assertions)]
20pub use crate::evaluator::evaluate_enrollment;
21pub use crate::schema::*;
22pub use crate::targeting::NimbusTargetingHelper;
23
24cfg_if::cfg_if! {
25    if #[cfg(feature = "stateful")] {
26
27        pub mod stateful;
28
29        pub use remote_settings::{RemoteSettingsConfig, RemoteSettingsServer};
30
31        pub use crate::stateful::nimbus_client::*;
32        pub use crate::stateful::matcher::AppContext;
33    } else {
34        pub mod stateless;
35
36        pub use crate::stateless::cirrus_client::*;
37        pub use crate::stateless::matcher::AppContext;
38    }
39}
40
41// Exposed for Example only
42pub use evaluator::TargetingAttributes;
43
44pub(crate) const SLUG_REPLACEMENT_PATTERN: &str = "{experiment}";
45
46#[cfg(test)]
47mod tests;