#[non_exhaustive]pub struct PostgresCollation { /* private fields */ }Expand description
A resolved PostgreSQL collation description.
Fields are private; use the constructors and PostgresCollation::with_rules
/ PostgresCollation::with_encoding to build one. rules and encoding
are part of the identity: a custom-rule collation or a non-UTF-8 source is
not reproducible by this crate and is refused at construction.
Implementations§
Source§impl PostgresCollation
impl PostgresCollation
Sourcepub fn c() -> Self
pub fn c() -> Self
Bytewise C/POSIX collation.
The comparison is bytewise, but the library only supports UTF-8 sources,
so a non-UTF-8 source is still refused at construction (the encoding
field defaults to UTF8; use PostgresCollation::with_encoding to
describe another).
Sourcepub fn icu(
locale: impl Into<String>,
deterministic: bool,
version: VersionId,
) -> Self
pub fn icu( locale: impl Into<String>, deterministic: bool, version: VersionId, ) -> Self
A PostgreSQL ICU collation description with no custom rules, assuming a
UTF-8 source. Use PostgresCollation::with_rules /
PostgresCollation::with_encoding to describe other sources.
Sourcepub fn libc(locale: impl Into<String>) -> Self
pub fn libc(locale: impl Into<String>) -> Self
A PostgreSQL libc collation description. Only C/POSIX are
reproducible (bytewise); any other libc locale is refused at
construction. Use PostgresCollation::c for the C locale directly.
Sourcepub fn with_rules(self, rules: impl Into<String>) -> Self
pub fn with_rules(self, rules: impl Into<String>) -> Self
Attach custom ICU collation rules (collicurules).
The library refuses any value here at construction — including the
empty string — with Error::Unsupported. Custom ICU rules are not
reproducible exactly; do not compare such a collation locally.
Sourcepub fn with_encoding(self, encoding: impl Into<String>) -> Self
pub fn with_encoding(self, encoding: impl Into<String>) -> Self
Set the source encoding (pg_collation/database encoding, e.g. UTF8,
LATIN1).
Sourcepub const fn provider(&self) -> PostgresProvider
pub const fn provider(&self) -> PostgresProvider
The provider.
Sourcepub const fn deterministic(&self) -> bool
pub const fn deterministic(&self) -> bool
Whether the source collation is deterministic.
Trait Implementations§
Source§impl Clone for PostgresCollation
impl Clone for PostgresCollation
Source§impl Debug for PostgresCollation
impl Debug for PostgresCollation
Source§impl<'de> Deserialize<'de> for PostgresCollation
Available on crate feature serde only.
impl<'de> Deserialize<'de> for PostgresCollation
serde only.Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for PostgresCollation
Source§impl Hash for PostgresCollation
impl Hash for PostgresCollation
Source§impl PartialEq for PostgresCollation
impl PartialEq for PostgresCollation
Source§impl Serialize for PostgresCollation
Available on crate feature serde only.
impl Serialize for PostgresCollation
serde only.