You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
C++ compare() taking std::u16string_view: Rust compare_utf16()
C++ compare() taking std::string_view: Rust compare_utf8()
C++ compare_unsafe() taking std::string_view: Rust compare() with documentation note that the call is UB unless the C++ caller has ensured UTF-8 validity.
(Once we support C++20, there should be std::u8string_view overloads for the same things that have std::string_view versions.)
In Rust, these return Ordering. It's a bit unclear if they should return int with values -1, 0, 1 or something fancier in C++.
The text was updated successfully, but these errors were encountered:
C++ compare() taking std::string_view: Rust compare_utf8()
To get Diplomat to use std::string_view in C++, the argument type of the method on the #[diplomat::opaque]ICU4XCollator should be &str, which should immediately get as_bytes() called on it.
C++ compare() taking std::u16string_view: Rust compare_utf16()
Fixed by #2498. That covers adding Collator FFI via Diplomat. The remaining details in the description of this issue -- about customizing the APIs produced in C++ -- are a part of the plan outlined in #2520.
Currently, the collator isn't exposed to C++ via Diplomat. It should be.
Apart from the constructor, the
Collator
object has three public methods in Rust:compare()
(takes guaranteed-valid UTF-8)compare_utf8()
(takes potentially-invalid UTF-8)compare_utf16()
(takes potentially-invalid UTF-16)I expect these to be exposed to C++ as follows:
compare()
takingstd::u16string_view
: Rustcompare_utf16()
compare()
takingstd::string_view
: Rustcompare_utf8()
compare_unsafe()
takingstd::string_view
: Rustcompare()
with documentation note that the call is UB unless the C++ caller has ensured UTF-8 validity.(Once we support C++20, there should be
std::u8string_view
overloads for the same things that havestd::string_view
versions.)In Rust, these return
Ordering
. It's a bit unclear if they should returnint
with values -1, 0, 1 or something fancier in C++.The text was updated successfully, but these errors were encountered: