| Crates.io | x-variant |
| lib.rs | x-variant |
| version | 0.1.2 |
| created_at | 2024-05-01 20:48:46.031602+00 |
| updated_at | 2024-11-12 07:03:53.472568+00 |
| description | Variant is a dynamic type container |
| homepage | https://github.com/libark/x |
| repository | https://github.com/libark/x |
| max_upload_size | |
| id | 1227068 |
| size | 44,737 |
Variant is a dynamic type container that can hold any type of value, and can change the type at runtime.
[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();