Skip to content

Create opaque type for a generic specialization with RefCell etc. #488

@zbraniecki

Description

@zbraniecki

I have:

bundle.rs:

pub type Memoizer = RefCell<IntlLangMemoizer>;
pub type FluentBundle<R> = bundle::FluentBundleBase<R, Memoizer>;

ffi.rs:

type FluentBundleRc = FluentBundle<Rc<FluentResource>>;

#[no_mangle]
pub unsafe extern "C" fn fluent_bundle_new(
    locales: &ThinVec<nsCString>,
    use_isolating: bool,
    pseudo_strategy: &nsACString,
) -> *mut FluentBundleRc;

cbindgen generates out of it:

using Memoizer = RefCell<IntlLangMemoizer>;

template<typename R>
using FluentBundle = FluentBundleBase<R, Memoizer>;

which results in an error:

 error: no template named 'RefCell'
 0:05.42 using Memoizer = RefCell<IntlLangMemoizer>;

It would be great to have cbindgen generate an opaque type in this case since all uses in C++ use it as opaque.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions