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§
- Represents an event capturing the assignment of a feature flag to a subject and its logging details.
- A client for Eppo API.
- Configuration for
Client. - Details about feature flag or bandit evaluation.
- A configuration poller thread.
Enums§
- Enum representing values assigned to a subject as a result of feature flag evaluation.
- Enum representing possible values of an attribute for a subject.
- Enum representing possible errors that can occur in the Eppo SDK.
- Enum representing possible errors that can occur during evaluation.
Traits§
- A trait for logging assignment events to your storage system. Implementations should handle persisting assignment events for analytics and tracking purposes.
Type Aliases§
- Type alias for a HashMap representing key-value pairs of attributes.
- Represents a result type for operations in the Eppo SDK.