Crate eppo

source ·
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:

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§

Enums§

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.