Sha256: 62b2ce6da0a373d88930d2948c2d6ed6cffa9e8064aae1a625bf4fec628b4832

Contents?: true

Size: 755 Bytes

Versions: 11

Compression:

Stored size: 755 Bytes

Contents

use ambient_authority::AmbientAuthority;
use iana_time_zone::get_timezone;

/// A reference to a timezone resource.
pub struct Timezone(());

#[derive(Debug)]
pub struct TimezoneError(String);

impl Timezone {
    /// Constructs a new instance of `Self`.
    ///
    /// # Ambient Authority
    ///
    /// This uses ambient authority to accesses clocks.
    #[inline]
    pub const fn new(ambient_authority: AmbientAuthority) -> Self {
        let _ = ambient_authority;
        Self(())
    }

    /// Returns the combined date and time with timezone.
    ///
    /// Converts NaiveTime to DateTime
    #[inline]
    pub fn timezone_name(&self) -> Result<String, TimezoneError> {
        get_timezone().map_err(|e| TimezoneError(e.to_string()))
    }
}

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
wasmtime-23.0.2 ./ext/cargo-vendor/cap-time-ext-3.0.0/src/timezone.rs
wasmtime-22.0.0 ./ext/cargo-vendor/cap-time-ext-3.0.0/src/timezone.rs
wasmtime-21.0.1 ./ext/cargo-vendor/cap-time-ext-3.0.0/src/timezone.rs
wasmtime-20.0.2 ./ext/cargo-vendor/cap-time-ext-3.0.0/src/timezone.rs
wasmtime-20.0.0 ./ext/cargo-vendor/cap-time-ext-3.0.0/src/timezone.rs
wasmtime-18.0.3 ./ext/cargo-vendor/cap-time-ext-2.0.1/src/timezone.rs
wasmtime-17.0.1 ./ext/cargo-vendor/cap-time-ext-2.0.1/src/timezone.rs
wasmtime-17.0.0 ./ext/cargo-vendor/cap-time-ext-2.0.1/src/timezone.rs
wasmtime-16.0.0 ./ext/cargo-vendor/cap-time-ext-2.0.1/src/timezone.rs
wasmtime-15.0.1 ./ext/cargo-vendor/cap-time-ext-2.0.1/src/timezone.rs
wasmtime-15.0.0 ./ext/cargo-vendor/cap-time-ext-2.0.1/src/timezone.rs