quickvariant-macros

Crates.ioquickvariant-macros
lib.rsquickvariant-macros
version0.1.1
created_at2025-07-29 10:29:39.525464+00
updated_at2025-07-31 21:24:54.265629+00
descriptionC++-style variant library.
homepage
repositoryhttps://github.com/uldor-alberich/quickvariant
max_upload_size
id1772173
size5,010
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