How to get UniquePtr<EnumMember> on the Rust side? (CXX crate)

Viewed 83

Using the cxx crate: https://crates.io/crates/cxx

I have the following struct on Rust:


#[cxx::bridge]
pub(crate) mod ffi {
    enum SizeType {
        BYTE,
        WORD,
        DWORD,
        QWORD,
    }
     unsafe extern "C++" {
         //...
     }
}

which is also mapped on C++. How do I get UniquePtr<SizeType> on Rust? Do I have to write a C++ function to get it? If I do, there's no point in having the struct on the Rust side.

I tried

let byte_ptr = UniquePtr::new(SizeType::BYTE);

but it does not work.

1 Answers
Related