>::Container,
diff --git a/components/experimental/src/transliterate/transliterator/replaceable.rs b/components/experimental/src/transliterate/transliterator/replaceable.rs
index 37dd944e31e..15ce2e51b28 100644
--- a/components/experimental/src/transliterate/transliterator/replaceable.rs
+++ b/components/experimental/src/transliterate/transliterator/replaceable.rs
@@ -579,6 +579,11 @@ pub(super) struct Reverse;
/// The direction a match can be applied. Used in [`Utf8Matcher`].
///
/// See [`Forward`] and [`Reverse`] for implementors.
+///
+///
+/// 🚫 This trait is sealed; it cannot be implemented by user code. If an API requests an item that implements this
+/// trait, please consider using a type from the implementors listed below.
+///
pub(super) trait MatchDirection: sealed::Sealed {}
impl MatchDirection for Forward {}
impl MatchDirection for Reverse {}
diff --git a/components/pattern/src/common.rs b/components/pattern/src/common.rs
index 04ecaa12e95..aa68d7dfd4e 100644
--- a/components/pattern/src/common.rs
+++ b/components/pattern/src/common.rs
@@ -62,6 +62,11 @@ where
///
/// The trait has no public methods and is not implementable outside of this crate.
///
+///
+/// 🚫 This trait is sealed; it cannot be implemented by user code. If an API requests an item that implements this
+/// trait, please consider using a type from the implementors listed below.
+///
+///
/// [`Pattern`]: crate::Pattern
// Debug so that `#[derive(Debug)]` on types generic in `PatternBackend` works
pub trait PatternBackend: crate::private::Sealed + 'static + core::fmt::Debug {
@@ -115,6 +120,8 @@ pub trait PatternBackend: crate::private::Sealed + 'static + core::fmt::Debug {
/// This trait can add [`Part`]s for individual literals or placeholders. The implementations
/// of this trait on standard types do not add any [`Part`]s.
///
+/// This trait has a blanket implementation and is therefore not implementable by user code.
+///
/// # Examples
///
/// A custom implementation that adds parts:
diff --git a/components/properties/src/code_point_map.rs b/components/properties/src/code_point_map.rs
index 843f9389420..e09ebd54ee9 100644
--- a/components/properties/src/code_point_map.rs
+++ b/components/properties/src/code_point_map.rs
@@ -342,6 +342,11 @@ impl<'a> CodePointMapDataBorrowed<'a, GeneralCategory> {
/// The descriptions of most properties are taken from [`TR44`], the documentation for the
/// Unicode Character Database.
///
+///
+/// 🚫 This trait is sealed; it cannot be implemented by user code. If an API requests an item that implements this
+/// trait, please consider using a type from the implementors listed below.
+///
+///
/// [`TR44`]: https://www.unicode.org/reports/tr44
pub trait EnumeratedProperty: crate::private::Sealed + TrieValue {
#[doc(hidden)]
diff --git a/components/properties/src/code_point_set.rs b/components/properties/src/code_point_set.rs
index e9406264491..7637e411688 100644
--- a/components/properties/src/code_point_set.rs
+++ b/components/properties/src/code_point_set.rs
@@ -204,6 +204,11 @@ impl<'a> CodePointSetDataBorrowed<'a> {
/// documentation for Unicode regular expressions. In particular, Annex C of this document
/// defines properties for POSIX compatibility.
///
+///
+/// 🚫 This trait is sealed; it cannot be implemented by user code. If an API requests an item that implements this
+/// trait, please consider using a type from the implementors listed below.
+///
+///
/// [`CodePointSetData`]: crate::sets::CodePointSetData
/// [`TR44`]: https://www.unicode.org/reports/tr44
/// [`TR18`]: https://www.unicode.org/reports/tr18
diff --git a/components/properties/src/emoji.rs b/components/properties/src/emoji.rs
index 7116012e890..591a7dacc2e 100644
--- a/components/properties/src/emoji.rs
+++ b/components/properties/src/emoji.rs
@@ -144,6 +144,11 @@ impl EmojiSetDataBorrowed<'static> {
}
/// An Emoji set as defined by [`Unicode Technical Standard #51`](https://unicode.org/reports/tr51/#Emoji_Sets>).
+///
+///
+/// 🚫 This trait is sealed; it cannot be implemented by user code. If an API requests an item that implements this
+/// trait, please consider using a type from the implementors listed below.
+///
pub trait EmojiSet: crate::private::Sealed {
#[doc(hidden)]
type DataMarker: DataMarker>;
diff --git a/components/properties/src/names.rs b/components/properties/src/names.rs
index 5a73ba26544..23b0f5f8336 100644
--- a/components/properties/src/names.rs
+++ b/components/properties/src/names.rs
@@ -650,6 +650,7 @@ pub trait ParseableEnumeratedProperty: crate::private::Sealed + TrieValue {
}
// Abstract over Linear/Sparse/Script representation
+// This trait is implicitly sealed by not being exported.
pub trait PropertyEnumToValueNameLookup {
fn get(&self, prop: u32) -> Option<&str>;
}
diff --git a/components/segmenter/src/lib.rs b/components/segmenter/src/lib.rs
index add3bd9749b..cefafebf2e3 100644
--- a/components/segmenter/src/lib.rs
+++ b/components/segmenter/src/lib.rs
@@ -167,3 +167,9 @@ pub use crate::word::WordBreakIteratorLatin1;
pub use crate::word::WordBreakIteratorPotentiallyIllFormedUtf8;
pub use crate::word::WordBreakIteratorUtf16;
pub use crate::word::WordBreakIteratorUtf8;
+
+pub(crate) mod private {
+ /// Trait marking other traits that are considered unstable and should not generally be
+ /// implemented outside of the segmenter crate.
+ pub trait Sealed {}
+}
diff --git a/components/segmenter/src/line.rs b/components/segmenter/src/line.rs
index c253b74deaa..d9b9acd23f6 100644
--- a/components/segmenter/src/line.rs
+++ b/components/segmenter/src/line.rs
@@ -715,22 +715,31 @@ fn is_break_utf32_by_loose(
/// A trait allowing for LineBreakIterator to be generalized to multiple string iteration methods.
///
/// This is implemented by ICU4X for several common string types.
-pub trait LineBreakType<'l, 's> {
+///
+///
+/// 🚫 This trait is sealed; it cannot be implemented by user code. If an API requests an item that implements this
+/// trait, please consider using a type from the implementors listed below.
+///
+pub trait LineBreakType<'l, 's>: crate::private::Sealed {
/// The iterator over characters.
type IterAttr: Iterator- + Clone;
/// The character type.
type CharType: Copy + Into;
+ #[doc(hidden)]
fn use_complex_breaking(iterator: &LineBreakIterator<'l, 's, Self>, c: Self::CharType) -> bool;
+ #[doc(hidden)]
fn get_linebreak_property_with_rule(
iterator: &LineBreakIterator<'l, 's, Self>,
c: Self::CharType,
) -> u8;
+ #[doc(hidden)]
fn get_current_position_character_len(iterator: &LineBreakIterator<'l, 's, Self>) -> usize;
+ #[doc(hidden)]
fn handle_complex_language(
iterator: &mut LineBreakIterator<'l, 's, Self>,
left_codepoint: Self::CharType,
@@ -1065,6 +1074,8 @@ impl<'l, 's, Y: LineBreakType<'l, 's>> LineBreakIterator<'l, 's, Y> {
#[derive(Debug)]
pub struct LineBreakTypeUtf8;
+impl crate::private::Sealed for LineBreakTypeUtf8 {}
+
impl<'l, 's> LineBreakType<'l, 's> for LineBreakTypeUtf8 {
type IterAttr = CharIndices<'s>;
type CharType = char;
@@ -1097,6 +1108,8 @@ impl<'l, 's> LineBreakType<'l, 's> for LineBreakTypeUtf8 {
#[derive(Debug)]
pub struct LineBreakTypePotentiallyIllFormedUtf8;
+impl crate::private::Sealed for LineBreakTypePotentiallyIllFormedUtf8 {}
+
impl<'l, 's> LineBreakType<'l, 's> for LineBreakTypePotentiallyIllFormedUtf8 {
type IterAttr = Utf8CharIndices<'s>;
type CharType = char;
@@ -1181,6 +1194,7 @@ where
#[derive(Debug)]
pub struct LineBreakTypeLatin1;
+impl crate::private::Sealed for LineBreakTypeLatin1 {}
impl<'s> LineBreakType<'_, 's> for LineBreakTypeLatin1 {
type IterAttr = Latin1Indices<'s>;
@@ -1211,6 +1225,7 @@ impl<'s> LineBreakType<'_, 's> for LineBreakTypeLatin1 {
#[derive(Debug)]
pub struct LineBreakTypeUtf16;
+impl crate::private::Sealed for LineBreakTypeUtf16 {}
impl<'s> LineBreakType<'_, 's> for LineBreakTypeUtf16 {
type IterAttr = Utf16Indices<'s>;
diff --git a/components/segmenter/src/rule_segmenter.rs b/components/segmenter/src/rule_segmenter.rs
index ad9923ef886..09ee3b512d3 100644
--- a/components/segmenter/src/rule_segmenter.rs
+++ b/components/segmenter/src/rule_segmenter.rs
@@ -11,15 +11,22 @@ use utf8_iter::Utf8CharIndices;
/// A trait allowing for RuleBreakIterator to be generalized to multiple string
/// encoding methods and granularity such as grapheme cluster, word, etc.
-pub trait RuleBreakType<'l, 's> {
+///
+///
+/// 🚫 This trait is sealed; it cannot be implemented by user code. If an API requests an item that implements this
+/// trait, please consider using a type from the implementors listed below.
+///
+pub trait RuleBreakType<'l, 's>: crate::private::Sealed {
/// The iterator over characters.
type IterAttr: Iterator- + Clone + core::fmt::Debug;
/// The character type.
type CharType: Copy + Into + core::fmt::Debug;
+ #[doc(hidden)]
fn get_current_position_character_len(iter: &RuleBreakIterator<'l, 's, Self>) -> usize;
+ #[doc(hidden)]
fn handle_complex_language(
iter: &mut RuleBreakIterator<'l, 's, Self>,
left_codepoint: Self::CharType,
@@ -258,6 +265,8 @@ impl<'l, 's, Y: RuleBreakType<'l, 's> + ?Sized> RuleBreakIterator<'l, 's, Y> {
#[derive(Debug)]
pub struct RuleBreakTypeUtf8;
+impl crate::private::Sealed for RuleBreakTypeUtf8 {}
+
impl<'s> RuleBreakType<'_, 's> for RuleBreakTypeUtf8 {
type IterAttr = CharIndices<'s>;
type CharType = char;
@@ -277,6 +286,8 @@ impl<'s> RuleBreakType<'_, 's> for RuleBreakTypeUtf8 {
#[derive(Debug)]
pub struct RuleBreakTypePotentiallyIllFormedUtf8;
+impl crate::private::Sealed for RuleBreakTypePotentiallyIllFormedUtf8 {}
+
impl<'s> RuleBreakType<'_, 's> for RuleBreakTypePotentiallyIllFormedUtf8 {
type IterAttr = Utf8CharIndices<'s>;
type CharType = char;
@@ -296,6 +307,8 @@ impl<'s> RuleBreakType<'_, 's> for RuleBreakTypePotentiallyIllFormedUtf8 {
#[derive(Debug)]
pub struct RuleBreakTypeLatin1;
+impl crate::private::Sealed for RuleBreakTypeLatin1 {}
+
impl<'s> RuleBreakType<'_, 's> for RuleBreakTypeLatin1 {
type IterAttr = Latin1Indices<'s>;
type CharType = u8;
@@ -315,6 +328,8 @@ impl<'s> RuleBreakType<'_, 's> for RuleBreakTypeLatin1 {
#[derive(Debug)]
pub struct RuleBreakTypeUtf16;
+impl crate::private::Sealed for RuleBreakTypeUtf16 {}
+
impl<'s> RuleBreakType<'_, 's> for RuleBreakTypeUtf16 {
type IterAttr = Utf16Indices<'s>;
type CharType = u32;
diff --git a/components/segmenter/src/word.rs b/components/segmenter/src/word.rs
index 695c6994cdc..a35a8493865 100644
--- a/components/segmenter/src/word.rs
+++ b/components/segmenter/src/word.rs
@@ -546,6 +546,7 @@ impl WordSegmenter {
#[derive(Debug)]
pub struct WordBreakTypeUtf8;
+impl crate::private::Sealed for WordBreakTypeUtf8 {}
impl<'l, 's> RuleBreakType<'l, 's> for WordBreakTypeUtf8 {
type IterAttr = CharIndices<'s>;
@@ -565,6 +566,7 @@ impl<'l, 's> RuleBreakType<'l, 's> for WordBreakTypeUtf8 {
#[derive(Debug)]
pub struct WordBreakTypePotentiallyIllFormedUtf8;
+impl crate::private::Sealed for WordBreakTypePotentiallyIllFormedUtf8 {}
impl<'l, 's> RuleBreakType<'l, 's> for WordBreakTypePotentiallyIllFormedUtf8 {
type IterAttr = Utf8CharIndices<'s>;
@@ -640,6 +642,8 @@ where
#[derive(Debug)]
pub struct WordBreakTypeUtf16;
+impl crate::private::Sealed for WordBreakTypeUtf16 {}
+
impl<'s> RuleBreakType<'_, 's> for WordBreakTypeUtf16 {
type IterAttr = Utf16Indices<'s>;
type CharType = u32;
diff --git a/components/timezone/src/time_zone.rs b/components/timezone/src/time_zone.rs
index 5050d26e777..039e5409ed4 100644
--- a/components/timezone/src/time_zone.rs
+++ b/components/timezone/src/time_zone.rs
@@ -12,6 +12,11 @@ mod private {
}
/// Trait encoding a particular data model for time zones.
+///
+///
+/// 🚫 This trait is sealed; it cannot be implemented by user code. If an API requests an item that implements this
+/// trait, please consider using a type from the implementors listed below.
+///
pub trait TimeZoneModel: private::Sealed {
/// The zone variant, if required for this time zone model.
type ZoneVariant: IntoOption + fmt::Debug + Copy;