icu_locid_transform/provider/
directionality.rs

1// This file is part of ICU4X. For terms of use, please see the file
2// called LICENSE at the top level of the ICU4X source tree
3// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).
4
5use super::*;
6use icu_provider::prelude::*;
7use zerovec::ZeroVec;
8
9#[icu_provider::data_struct(marker(
10    ScriptDirectionV1Marker,
11    "locid_transform/script_dir@1",
12    singleton
13))]
14#[derive(Debug, PartialEq, Clone)]
15#[cfg_attr(
16    feature = "datagen",
17    derive(serde::Serialize, databake::Bake),
18    databake(path = icu_locid_transform::provider),
19)]
20#[cfg_attr(feature = "serde", derive(serde::Deserialize))]
21/// This directionality data is used to determine the script directionality of a locale.
22///
23/// <div class="stab unstable">
24/// 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways,
25/// including in SemVer minor releases. While the serde representation of data structs is guaranteed
26/// to be stable, their Rust representation might not be. Use with caution.
27/// </div>
28#[yoke(prove_covariance_manually)]
29pub struct ScriptDirectionV1<'data> {
30    /// Scripts in right-to-left direction.
31    #[cfg_attr(feature = "serde", serde(borrow))]
32    pub rtl: ZeroVec<'data, UnvalidatedScript>,
33    /// Scripts in left-to-right direction.
34    #[cfg_attr(feature = "serde", serde(borrow))]
35    pub ltr: ZeroVec<'data, UnvalidatedScript>,
36}