#unleash #sdk #domain #experimental #extracted #yggdrasil #own


This is the Unleash SDK domain logic extracted into a library to facilitate building your own Unleash SDKs in anything, anywhere

28 releases (12 breaking)

new 0.13.0 Jul 19, 2024
0.11.0 Feb 29, 2024
0.8.0 Nov 13, 2023
0.5.9 Jul 18, 2023
0.5.3 Mar 3, 2023

#296 in Network programming

Download history 26/week @ 2024-03-28 12/week @ 2024-04-04 16/week @ 2024-04-11 174/week @ 2024-04-18 164/week @ 2024-04-25 33/week @ 2024-05-02 24/week @ 2024-05-09 20/week @ 2024-05-16 17/week @ 2024-05-23 9/week @ 2024-05-30 45/week @ 2024-06-06 25/week @ 2024-06-13 7/week @ 2024-06-20 3/week @ 2024-06-27 8/week @ 2024-07-04 72/week @ 2024-07-11

93 downloads per month
Used in 3 crates

MIT license

3.5K SLoC


Yggdrasil is a Rust project designed to create the core of the Unleash SDK domain logic in a single language. This crate is the Rust logic extracted into a standalone crate so that the logic can be used natively inside a Rust application. This is a very experimental crate, so if you're looking to connect a Rust application to Unleash, you should use the official Rust SDK instead, the API and philosophy here are subject to change until this is in stable.

Using Yggdrasil in a Rust project

The heart of Yggdrasil is the EngineState struct, this is a lightweight struct that does very little on its own, it's cheap to create but you probably only need/want one of them:

let engine = EngineState::default();

The engine needs to be populated with an Unleash response before it will return anything useful. The shape of the data here should be identical to the response returned by Unleash, if you'd like to handroll your own data, you can check out the format of the ClientFeatures struct here.

let spec_data = "";// Some json blob, matching the Unleash format

let unleash_data: ClientFeatures = serde_json::from_str(&spec_data).unwrap();


Now you can query the engine for a given toggle:

let context = InnerContext::default();

let enabled = engine.is_enabled("my-toggle-name", &context);

//Do something with the enabled state here


cargo smart-release -u -b patch unleash-yggdrasil


~158K SLoC