pub struct TimeZoneAbbreviations { /* private fields */ }Expand description
A timezone_abbreviations set, the abbreviations a literal may write for its zone.
use sql_values::{TimeZoneAbbreviations, TimeZoneAbbreviationsError};
let local = |name: &str| Some(match name {
"Local" => "@INCLUDE Default\n@OVERRIDE\nIST 19800 # India\n",
other => TimeZoneAbbreviations::bundled_file(other)?,
});
assert!(TimeZoneAbbreviations::load("Local", local).is_ok());
let clash = |name: &str| match name {
"Clash" => Some("@INCLUDE Default\nIST 19800\n"),
other => TimeZoneAbbreviations::bundled_file(other),
};
assert_eq!(
TimeZoneAbbreviations::load("Clash", clash),
Err(TimeZoneAbbreviationsError::MultiplyDefined {
abbreviation: "ist".to_owned(),
file: "Clash".to_owned(),
line: 2,
}),
);Implementations§
Source§impl TimeZoneAbbreviations
impl TimeZoneAbbreviations
Sourcepub fn bundled(name: &str) -> Option<&'static Self>
pub fn bundled(name: &str) -> Option<&'static Self>
The set PostgreSQL installs as name, Default, Australia or India, as
timezone_abbreviations names it.
Sourcepub fn bundled_file(name: &str) -> Option<&'static str>
pub fn bundled_file(name: &str) -> Option<&'static str>
The text of the file PostgreSQL installs as name, for a set of its own that includes
one.
Sourcepub fn load<'f>(
name: &str,
files: impl FnMut(&str) -> Option<&'f str>,
) -> Result<Self, TimeZoneAbbreviationsError>
pub fn load<'f>( name: &str, files: impl FnMut(&str) -> Option<&'f str>, ) -> Result<Self, TimeZoneAbbreviationsError>
PostgreSQL 18’s load_tzoffsets, the set of the file name, which files holds with
every file it includes, as PostgreSQL’s timezonesets directory holds them.
§Errors
The TimeZoneAbbreviationsError PostgreSQL raises for the file or one it includes.
Trait Implementations§
Source§impl Clone for TimeZoneAbbreviations
impl Clone for TimeZoneAbbreviations
Source§impl Debug for TimeZoneAbbreviations
impl Debug for TimeZoneAbbreviations
impl Eq for TimeZoneAbbreviations
Source§impl Hash for TimeZoneAbbreviations
impl Hash for TimeZoneAbbreviations
Source§impl PartialEq for TimeZoneAbbreviations
impl PartialEq for TimeZoneAbbreviations
impl StructuralPartialEq for TimeZoneAbbreviations
Auto Trait Implementations§
impl Forget for TimeZoneAbbreviations
impl Freeze for TimeZoneAbbreviations
impl RefUnwindSafe for TimeZoneAbbreviations
impl Send for TimeZoneAbbreviations
impl Sync for TimeZoneAbbreviations
impl Unpin for TimeZoneAbbreviations
impl UnsafeUnpin for TimeZoneAbbreviations
impl UnwindSafe for TimeZoneAbbreviations
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more