Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot find Datetime when importing #25

Closed
alexzanderr opened this issue Mar 27, 2022 · 1 comment
Closed

cannot find Datetime when importing #25

alexzanderr opened this issue Mar 27, 2022 · 1 comment

Comments

@alexzanderr
Copy link

hello.

im trying to run an example from tz-db crate that was made for this crate.

use tz::{DateTime, TimeZone};
use tzdb::{time_zone, tz_by_name};

// access by identifier
DateTime::now(time_zone::europe::KIEV);
// access by name
DateTime::now(tz_by_name("Europe/Berlin").unwrap());
// names are case insensitive
DateTime::now(tz_by_name("ArCtIc/LongYeArByEn").unwrap())

but when im trying to run this example (with main function ofc)

error[E0432]: unresolved imports `tz::DateTime`, `tz::TimeZone`
 --> timezones/src/main.rs:4:10
  |
4 | use tz::{DateTime, TimeZone};
  |          ^^^^^^^^  ^^^^^^^^ no `TimeZone` in the root
  |          |
  |          no `DateTime` in the root

For more information about this error, try `rustc --explain E0432`.
error: could not compile `timezones` due to previous error

my cargo toml has

[package]
name = "timezones"
version = "0.1.0"
edition = "2021"

[dependencies]
tz = "0.2.1"
tzdb = "0.2.0"

rustc and cargo versions are

❱  rustc -V
rustc 1.60.0-nightly (c5c610aad 2022-02-14)

❱  cargo -V
cargo 1.60.0-nightly (c082648 2022-02-08)

maybe am i missing some feature from this crate ?

what am i missing, because i dont feel that this is wrong.

thanks in advance.

@alexzanderr
Copy link
Author

fixed it.

i had the wrong crate name inside cargo toml

to fix it:

[package]
name = "timezones"
version = "0.1.0"
edition = "2021"

[dependencies]
- tz = "0.2.1"
+ tz-rs = "0.6.7"
tzdb = "0.2.0"

cause: i accidentally added tz crate with cargo add tz, instead of cargo add tz-rs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant