Skip to content

An unofficial Rust SDK for Optimizely Feature Experimentation

Notifications You must be signed in to change notification settings

MarkBiesheuvel/optimizely-rust-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Optimizely Feature Experimentation - Rust SDK

An unofficial Rust SDK for Optimizely Feature Experimentation.

This SDK is not supported by Optimizely!

This SDK only includes a small subset of features compared to supported SDKs. Use at own risk!

Example

use optimizely::{event_api::BatchedEventDispatcher, Client};

// Initialize Optimizely client using local datafile
let file_path = "../datafiles/sandbox.json";
let optimizely_client = Client::from_local_datafile(file_path)?
    .with_event_dispatcher(BatchedEventDispatcher::default())
    .initialize();

// Create user context for current user
let user_id = "123abc789xyz";
let user_context = optimizely_client.create_user_context(user_id);

// Get decision for the Buy Button feature flag
let feature_flag = "buy_button";
let decision = user_context.decide(feature_flag);

// Return Ok for doc-tests
Ok::<(), Box<dyn std::error::Error>>(())

Included features

A list of the features that are currently included:

  • Initialize client from local datafile
  • Initialize client from SDK key
  • Periodically poll latest datafile
  • Event dispatcher (synchronous)
  • Event dispatcher (batched)
  • Logger
  • Notification listeners
  • Decide option (DisableDecisionEvent)
  • Decide options (others)
  • Creating an user context
  • Decide method consistent with other SDKs
  • Evaluating audience conditions
  • Variation variables
  • Forced decision methods
  • Mutual exclusion groups

About

An unofficial Rust SDK for Optimizely Feature Experimentation

Topics

Resources

Stars

Watchers

Forks