Skip to content

Commit

Permalink
Introduce Collation::resolve
Browse files Browse the repository at this point in the history
  • Loading branch information
blackbeam committed May 15, 2024
1 parent 8695d40 commit 227e384
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/collations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3846,12 +3846,10 @@ impl<'a> Collation<'a> {
pub fn max_len(&self) -> u8 {
self.max_len
}
}

impl From<CollationId> for Collation<'static> {
/// Convert a collation ID to a collation.
fn from(value: CollationId) -> Self {
match value {
/// Resolve collation id into a collation.
pub const fn resolve(id: CollationId) -> Collation<'static> {
match id {
CollationId::UNKNOWN_COLLATION_ID => Self::UNKNOWN_COLLATION,
CollationId::BIG5_CHINESE_CI => Self::BIG5_CHINESE_CI_COLLATION,
CollationId::LATIN2_CZECH_CS => Self::LATIN2_CZECH_CS_COLLATION,
Expand Down Expand Up @@ -4142,3 +4140,10 @@ impl From<CollationId> for Collation<'static> {
}
}
}

impl From<CollationId> for Collation<'static> {
/// Convert a collation ID to a collation.
fn from(value: CollationId) -> Self {
Collation::resolve(value)
}
}

0 comments on commit 227e384

Please sign in to comment.