On Mon, Aug 15, 2016 at 6:45 PM, Jim Blandy <jbla...@mozilla.com> wrote:
> We're using Cheddar to produce C headers for our Rust mp4parse crate; as far
> as I can see, Cheddar doesn't mangle Rust names.
>
> The Mozilla C++ style applies only to identifiers defined in Mozilla's C++
> code base, not things that we merely use that are defined elsewhere. When we
> use upstream code, we use its definitions in the form they're offered. I
> think Rust code should be treated similarly to "upstream" code in that
> sense, and the C++ should use the Rust names unchanged.

encoding_rs has three layers of API:
 1) Rust
 2) FFI/C
 3) C++ that wraps the C API so that it can be used in a C++-like way
with unique pointers doing the right thing.

I think it's been already established that snake_case should be used
on layers 1 and 2. So on layer 1, there is Encoding::for_label(label:
&[u8]). On layer 2, there's encoding_for_label(const uint8_t* label,
size_t label_len). This is clear, and I don't want to reopen the
discussion on that.

For non-Gecko uses,
https://github.com/hsivonen/encoding_rs/blob/master/include/encoding_rs_cpp.h
has:
Encoding::for_label(gsl::cstring_span<> label)

What I'm asking is:

When I take encoding_rs_cpp.h and adapt it to XPCOM/MFBT types for use
in Gecko, should this be
Encoding::for_label(const nsACString& label) // change only types that
need changing
or
Encoding::ForLabel(const nsACString& aLabel) // change naming style, too
?

-- 
Henri Sivonen
hsivo...@hsivonen.fi
https://hsivonen.fi/
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to