diff options
Diffstat (limited to 'intl/icu_capi/cpp/docs/source/provider_ffi.rst')
-rw-r--r-- | intl/icu_capi/cpp/docs/source/provider_ffi.rst | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/intl/icu_capi/cpp/docs/source/provider_ffi.rst b/intl/icu_capi/cpp/docs/source/provider_ffi.rst new file mode 100644 index 0000000000..fcd53586cd --- /dev/null +++ b/intl/icu_capi/cpp/docs/source/provider_ffi.rst @@ -0,0 +1,84 @@ +``provider::ffi`` +================= + +.. cpp:class:: ICU4XDataProvider + + An ICU4X data provider, capable of loading ICU4X data keys from some source. + + See the `Rust documentation for icu_provider <https://docs.rs/icu_provider/latest/icu_provider/index.html>`__ for more information. + + + .. cpp:function:: static ICU4XDataProvider create_compiled() + + Constructs an :cpp:class:`ICU4XDataProvider` that uses compiled data. + + Requires the ``compiled_data`` feature. + + This provider cannot be modified or combined with other providers, so ``enable_fallback``, ``enabled_fallback_with``, ``fork_by_locale``, and ``fork_by_key`` will return ``Err``s. + + + .. cpp:function:: static diplomat::result<ICU4XDataProvider, ICU4XError> create_fs(const std::string_view path) + + Constructs an ``FsDataProvider`` and returns it as an :cpp:class:`ICU4XDataProvider`. Requires the ``provider_fs`` Cargo feature. Not supported in WASM. + + See the `Rust documentation for FsDataProvider <https://docs.rs/icu_provider_fs/latest/icu_provider_fs/struct.FsDataProvider.html>`__ for more information. + + + .. cpp:function:: static ICU4XDataProvider create_test() + + Deprecated + + Use ``create_compiled()``. + + + .. cpp:function:: static diplomat::result<ICU4XDataProvider, ICU4XError> create_from_byte_slice(const diplomat::span<const uint8_t> blob) + + Constructs a ``BlobDataProvider`` and returns it as an :cpp:class:`ICU4XDataProvider`. + + See the `Rust documentation for BlobDataProvider <https://docs.rs/icu_provider_blob/latest/icu_provider_blob/struct.BlobDataProvider.html>`__ for more information. + + Lifetimes: ``blob`` must live for the duration of the program. + + + .. cpp:function:: static ICU4XDataProvider create_empty() + + Constructs an empty :cpp:class:`ICU4XDataProvider`. + + See the `Rust documentation for EmptyDataProvider <https://docs.rs/icu_provider_adapters/latest/icu_provider_adapters/empty/struct.EmptyDataProvider.html>`__ for more information. + + + .. cpp:function:: diplomat::result<std::monostate, ICU4XError> fork_by_key(ICU4XDataProvider& other) + + Creates a provider that tries the current provider and then, if the current provider doesn't support the data key, another provider ``other``. + + This takes ownership of the ``other`` provider, leaving an empty provider in its place. + + The providers must be the same type (Any or Buffer). This condition is satisfied if both providers originate from the same constructor, such as ``create_from_byte_slice`` or ``create_fs``. If the condition is not upheld, a runtime error occurs. + + See the `Rust documentation for ForkByKeyProvider <https://docs.rs/icu_provider_adapters/latest/icu_provider_adapters/fork/type.ForkByKeyProvider.html>`__ for more information. + + + .. cpp:function:: diplomat::result<std::monostate, ICU4XError> fork_by_locale(ICU4XDataProvider& other) + + Same as ``fork_by_key`` but forks by locale instead of key. + + See the `Rust documentation for MissingLocalePredicate <https://docs.rs/icu_provider_adapters/latest/icu_provider_adapters/fork/predicates/struct.MissingLocalePredicate.html>`__ for more information. + + + .. cpp:function:: diplomat::result<std::monostate, ICU4XError> enable_locale_fallback() + + Enables locale fallbacking for data requests made to this provider. + + Note that the test provider (from ``create_test``) already has fallbacking enabled. + + See the `Rust documentation for try_new <https://docs.rs/icu_provider_adapters/latest/icu_provider_adapters/fallback/struct.LocaleFallbackProvider.html#method.try_new>`__ for more information. + + Additional information: `1 <https://docs.rs/icu_provider_adapters/latest/icu_provider_adapters/fallback/struct.LocaleFallbackProvider.html>`__ + + + .. cpp:function:: diplomat::result<std::monostate, ICU4XError> enable_locale_fallback_with(const ICU4XLocaleFallbacker& fallbacker) + + See the `Rust documentation for new_with_fallbacker <https://docs.rs/icu_provider_adapters/latest/icu_provider_adapters/fallback/struct.LocaleFallbackProvider.html#method.new_with_fallbacker>`__ for more information. + + Additional information: `1 <https://docs.rs/icu_provider_adapters/latest/icu_provider_adapters/fallback/struct.LocaleFallbackProvider.html>`__ + |