launchdarkly_server_sdk_evaluation/
lib.rs

1//! This crate contains the LaunchDarkly Rust SDK feature flag evaluation engine.
2//!
3//! Normal use of the Rust SDK does not require referencing this crate directly. It is used internally
4//! by the SDK, but is published and versioned separately so it can be used in other LaunchDarkly
5//! components without making the SDK versioning dependent on these internal APIs.
6
7#![deny(rustdoc::missing_crate_level_docs)]
8#![deny(missing_docs)]
9
10mod attribute_value;
11mod contexts;
12mod eval;
13mod flag;
14mod flag_value;
15mod rule;
16mod segment;
17mod store;
18mod test_common;
19mod util;
20mod variation;
21
22pub use attribute_value::AttributeValue;
23pub use contexts::attribute_reference::Reference;
24pub use contexts::context::{Context, ContextAttributes, Kind};
25pub use contexts::context_builder::{ContextBuilder, MultiContextBuilder};
26pub use eval::*;
27pub use flag::*;
28pub use flag_value::*;
29pub use rule::*;
30pub use segment::*;
31pub use store::*;
32pub use variation::*;
33
34/// Trait indicating that the item is versioned.
35pub trait Versioned {
36    /// Retrieve the version for this item instance.
37    fn version(&self) -> u64;
38
39    /// Determine if this item's version is greater than or equal to the provided version
40    /// parameter.
41    fn is_greater_than_or_equal(&self, version: u64) -> bool {
42        self.version() >= version
43    }
44}
45
46#[cfg(test)]
47pub(crate) mod proptest_generators {
48    pub(crate) use crate::contexts::attribute_reference::proptest_generators::*;
49    pub(crate) use crate::contexts::context::proptest_generators::*;
50    pub(crate) use crate::rule::proptest_generators::*;
51    pub(crate) use crate::variation::proptest_generators::*;
52}