3 releases

0.1.2 Nov 12, 2024
0.1.1 May 21, 2024
0.1.0 May 1, 2024

#6 in #hold

Download history 2/week @ 2024-09-11 6/week @ 2024-09-18 19/week @ 2024-09-25 7/week @ 2024-10-02 83/week @ 2024-11-06 63/week @ 2024-11-13 26/week @ 2024-11-20 21/week @ 2024-11-27 46/week @ 2024-12-04 32/week @ 2024-12-11 20/week @ 2024-12-18 19/week @ 2024-12-25

121 downloads per month
Used in 7 crates (6 directly)

MIT/Apache

28KB
675 lines

x-variant

Version Documentation License License

Variant is a dynamic type container that can hold any type of value, and can change the type at runtime.

Example

[dependencies]
x-variant= "0.1"
use x_variant::Variant;

let mut v = Variant::new();
v.set(12);
i: i32 = v.get();
v.set("Hello, world!");

// Array
let mut v = Variant::new();
v[100] = "test".into();

// Dictionary
let mut v = Variant::new();
v["key"] = "value".into();
v["x"]["y"] = 3.1415926f64.into();

Dependencies

~485–790KB
~17K SLoC