Code Monkey home page Code Monkey logo

zoneinfo-compiled's Introduction

zoneinfo_compiled zoneinfo_compiled on crates.io Build Status

This is a library for parsing compiled versions of the Olson zoneinfo database.

Installation

This crate works with Cargo. Add the following to your Cargo.toml dependencies section:

[dependencies]
datetime = "0.5"
zoneinfo_compiled = "0.5"

The earliest version of Rust that this crate is tested against is Rust v1.31.0.

zoneinfo-compiled's People

Contributors

ignatenkobrain avatar joshleeb avatar ogham avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

zoneinfo-compiled's Issues

Failed to parse some specific timezones

Causes ogham/exa#517

Way to reproduce (with master branch 2d8a832) :

use zoneinfo_compiled::CompiledData;
use datetime::TimeZone;

pub fn main() -> Result<(), Box<dyn std::error::Error>> {
    TimeZone::from_file("/usr/share/zoneinfo/Asia/Muscat")?;
    Ok(())
}

Or manually set the current time to those and read /etc/localtime instead.
Timezone that I found failed to parse includes but not limits to UTF+3 (including Amman, Aden) and UTF+8 (including Shanghai, Hong_Kong,Macau)

Many other timezone works just fine.

log:

thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/libcore/slice/mod.rs:2686:10
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
   1: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at src/libstd/sys_common/backtrace.rs:59
             at src/libstd/panicking.rs:197
   3: std::panicking::default_hook
             at src/libstd/panicking.rs:211
   4: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:474
   5: std::panicking::continue_panic_fmt
             at src/libstd/panicking.rs:381
   6: rust_begin_unwind
             at src/libstd/panicking.rs:308
   7: core::panicking::panic_fmt
             at src/libcore/panicking.rs:85
   8: core::panicking::panic_bounds_check
             at src/libcore/panicking.rs:61
   9: <usize as core::slice::SliceIndex<[T]>>::index
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/libcore/slice/mod.rs:2686
  10: core::slice::<impl core::ops::index::Index<I> for [T]>::index
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/libcore/slice/mod.rs:2543
  11: <alloc::vec::Vec<T> as core::ops::index::Index<I>>::index
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/liballoc/vec.rs:1677
  12: zoneinfo_compiled::cook
             at src/lib.rs:135
  13: zoneinfo_compiled::parse
             at src/lib.rs:110
  14: <datetime::cal::zone::TimeZone as zoneinfo_compiled::CompiledData>::parse
             at src/lib.rs:39
  15: zoneinfo_compiled::CompiledData::from_file
             at ./src/lib.rs:32
  16: zoneinfo_compiled::main
             at src/main.rs:8
  17: std::rt::lang_start::{{closure}}
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/libstd/rt.rs:64
  18: std::panicking::try::do_call
             at src/libstd/rt.rs:49
             at src/libstd/panicking.rs:293
  19: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:87
  20: std::rt::lang_start_internal
             at src/libstd/panicking.rs:272
             at src/libstd/panic.rs:388
             at src/libstd/rt.rs:48
  21: std::rt::lang_start
             at /rustc/3c235d5600393dfe6c36eeed34042efad8d4f26e/src/libstd/rt.rs:64
  22: main
  23: __libc_start_main
  24: _start

include license text

MIT requires text license to be present along with sources. You would help me a lot if you could put it into repo & make new release.

Use of unstable library feature

Hey there,

The following lines in lib.rs feature an unstable feature (copied).

let std_flag = tz.standard_flags.get(i).copied().unwrap_or_default() != 
let gmt_flag = tz.gmt_flags.get(i).copied().unwrap_or_default() != 0;

https://github.com/rust-datetime/zoneinfo-compiled/blob/master/src/lib.rs#L131-L132

Error thrown:

error[E0658]: use of unstable library feature 'copied' (see issue #57126)
   --> /home/keo7/.cargo/registry/src/github.com-1ecc6299db9ec823/zoneinfo_compiled-0.4.8/src/lib.rs:131:49
    |
131 |         let std_flag = tz.standard_flags.get(i).copied().unwrap_or_default() != 0;
    |                                                 ^^^^^^
    |

error[E0658]: use of unstable library feature 'copied' (see issue #57126)
   --> /home/keo7/.cargo/registry/src/github.com-1ecc6299db9ec823/zoneinfo_compiled-0.4.8/src/lib.rs:132:44
    |
132 |         let gmt_flag = tz.gmt_flags.get(i).copied().unwrap_or_default() != 0;
    |                                            ^^^^^^
    |

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0658`.
error: Could not compile `zoneinfo_compiled`.

Best wishes

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.