quickvariant

Crates.ioquickvariant
lib.rsquickvariant
version0.1.3
created_at2025-07-29 10:30:01.170501+00
updated_at2025-07-31 21:25:14.716609+00
descriptionC++-style variant library.
homepage
repositoryhttps://github.com/uldor-alberich/quickvariant
max_upload_size
id1772174
size7,364
UldorAlberich13 (uldor-alberich)

documentation

README

QuickVariant

This library is designed with reference to C++'s std::variant, allowing you to create variants using only type names.

Warning

This library uses unsafe code. Please follow the usage guidelines carefully when using it. Rust's enum is extremely powerful, and in most cases, the functionality provided by this crate can be fully replaced by a simple enum.

Example

// Please be sure to initialize using quickvariant::macros::make_variant!.
let mut variant = quickvariant::macros::make_variant!(i32, u64, String);

unsafe {
    variant.set(String::from("Hello, World")).unwrap();
}

println!("{:#?}", variant.get::<String>().unwrap());

License

QuickVariant is licensed under the MIT license (see LICENSE in the main repository).

Commit count: 0

cargo fmt