Expand description
The Rust SDK for Eppo, a next-generation feature flagging and experimentation platform.
§Overview
The SDK revolves around a Client
that evaluates feature flag values for “subjects”, where each
subject has a unique key and key-value attributes associated with it. Feature flag evaluation
results in an AssignmentValue
being returned, representing a specific feature flag value assigned
to the subject.
§Typed assignments
Every Eppo flag has a return type that is set once on creation in the dashboard. Once a flag is created, assignments in code should be made using the corresponding typed function:
Client::get_string_assignment()
Client::get_integer_assignment()
Client::get_numeric_assignment()
Client::get_boolean_assignment()
Client::get_json_assignment()
These functions provide additional type safety over Client::get_assignment()
as they can
detect type mismatch even before evaluating the feature, so the error is returned even if
subject is otherwise uneligible (get_assignment()
return Ok(None)
in that case).
§Assignment logger
An AssignmentLogger
should be provided to save assignment events to your storage,
facilitating tracking of which user received which feature flag values.
let config = ClientConfig::from_api_key("api-key").assignment_logger(|assignment| {
println!("{:?}", assignment);
});
§Error Handling
Errors are represented by the Error
enum.
In production, it is recommended to ignore all errors, as feature flag evaluation should not be critical enough to cause system crashes. However, the returned errors are valuable for debugging and usually indicate that developer’s attention is needed.
§Logging
The package uses the log
crate for logging
messages. Consider integrating a log
-compatible logger implementation for better visibility
into SDK operations.
§Examples
Examples can be found in the examples directory
of the eppo
crate repository.
Structs§
- Allocation
Evaluation Details - Assignment
Event - Represents an event capturing the assignment of a feature flag to a subject and its logging details.
- Attribute
Value - Attribute of a subject or action.
- Categorical
Attribute - Categorical attributes are attributes that have a finite set of values that are not directly comparable (i.e., enumeration).
- Client
- A client for Eppo API.
- Client
Config - Configuration for
Client
. - Condition
Evaluation Details - Evaluation
Details - Details about feature flag or bandit evaluation.
- Evaluation
Result With Details - Numeric
Attribute - Numeric attributes are quantitative (e.g., real numbers) and define a scale.
- Poller
Thread - A configuration poller thread.
- Rule
Evaluation Details - Shard
Evaluation Details - Split
Evaluation Details
Enums§
- Allocation
Evaluation Code - Assignment
Value - Enum representing values assigned to a subject as a result of feature flag evaluation.
- Bandit
Evaluation Code - Error
- Enum representing possible errors that can occur in the Eppo SDK.
- Evaluation
Error - Enum representing possible errors that can occur during evaluation.
- Flag
Evaluation Code
Traits§
- Assignment
Logger - A trait for logging assignment events to your storage system. Implementations should handle persisting assignment events for analytics and tracking purposes.
Type Aliases§
- Attributes
- Type alias for a HashMap representing key-value pairs of attributes.
- Result
- Represents a result type for operations in the Eppo SDK.