mirror of
https://github.com/0x5eal/chrono-lc.git
synced 2024-12-12 04:40:36 +00:00
refactor: modernize codebase for rust edition 2021
This commit is contained in:
parent
9965c3355c
commit
85043c4a3e
14 changed files with 22 additions and 62 deletions
|
@ -1,5 +1,5 @@
|
|||
[package]
|
||||
name = "chrono_locale"
|
||||
name = "chrono_lc"
|
||||
version = "0.1.2"
|
||||
edition = "2021"
|
||||
authors = ["Alessandro Pellizzari <alex@amiran.it>", "Erica Marigold <hi@devcomp.xyz>"]
|
||||
|
|
14
README.md
14
README.md
|
@ -9,14 +9,14 @@ Put this in your Cargo.toml:
|
|||
```toml
|
||||
[dependencies]
|
||||
chrono = "0.4.56"
|
||||
chrono_locale = { git = "https://github.com/0x5eal/chrono-locale.git", tag = "v0.1.2" }
|
||||
chrono_lc = "0.1.2"
|
||||
```
|
||||
|
||||
Then put this in your `lib.rs` or `main.rs`:
|
||||
|
||||
```rs
|
||||
use chrono::prelude::*;
|
||||
use chrono_locale::LocaleDate;
|
||||
use chrono_lc::LocaleDate;
|
||||
```
|
||||
|
||||
You can choose to import just parts of chrono instead of the whole prelude.
|
||||
|
@ -26,11 +26,11 @@ To format a chrono `Date` or `DateTime` object, you can use the `formatl` method
|
|||
|
||||
```rs
|
||||
let dt = FixedOffset::east_opt(34200)
|
||||
.unwrap()
|
||||
.with_ymd_and_hms(2001, 7, 8, 0, 34, 59)
|
||||
.unwrap()
|
||||
.with_nanosecond(1_026_490_708)
|
||||
.unwrap();
|
||||
.unwrap()
|
||||
.with_ymd_and_hms(2001, 7, 8, 0, 34, 59)
|
||||
.unwrap()
|
||||
.with_nanosecond(1_026_490_708)
|
||||
.unwrap();
|
||||
|
||||
println!("{}", dt.formatl("%c", "fr"));
|
||||
```
|
||||
|
|
7
build.rs
7
build.rs
|
@ -1,9 +1,4 @@
|
|||
extern crate serde;
|
||||
extern crate walkdir;
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
extern crate serde_json;
|
||||
|
||||
use serde_derive::Deserialize;
|
||||
use serde_json::Error as JsonError;
|
||||
use std::env;
|
||||
use std::fs::File;
|
||||
|
|
11
src/lib.rs
11
src/lib.rs
|
@ -8,17 +8,14 @@
|
|||
//! ```toml
|
||||
//! [dependencies]
|
||||
//! chrono = "0.4"
|
||||
//! chrono_locale = { git = "https://github.com/0x5eal/chrono-locale.git", tag = "v0.1.2" }
|
||||
//! chrono_lc = "0.1.2"
|
||||
//! ```
|
||||
//!
|
||||
//! Then put this in your `lib.rs` or `main.rs`:
|
||||
//!
|
||||
//! ```rust
|
||||
//! extern crate chrono;
|
||||
//! extern crate chrono_locale;
|
||||
//!
|
||||
//! use chrono::prelude::*;
|
||||
//! use chrono_locale::LocaleDate;
|
||||
//! use chrono_lc::LocaleDate;
|
||||
//! ```
|
||||
//!
|
||||
//! You can choose to import just parts of chrono instead of the whole prelude.
|
||||
|
@ -28,7 +25,7 @@
|
|||
//!
|
||||
//! ```rust
|
||||
//! # use chrono::prelude::*;
|
||||
//! # use chrono_locale::LocaleDate;
|
||||
//! # use chrono_lc::LocaleDate;
|
||||
//!
|
||||
//! let dt = FixedOffset::east_opt(34200)
|
||||
//! .unwrap()
|
||||
|
@ -60,8 +57,6 @@
|
|||
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
extern crate chrono;
|
||||
extern crate num_integer;
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::fmt;
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
extern crate chrono;
|
||||
extern crate chrono_locale;
|
||||
|
||||
use chrono::{FixedOffset, TimeZone, Timelike};
|
||||
use chrono_locale::LocaleDate;
|
||||
use chrono_lc::LocaleDate;
|
||||
|
||||
// This test is copied from chrono's, disabling unsupported features
|
||||
#[test]
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
extern crate chrono;
|
||||
extern crate chrono_locale;
|
||||
|
||||
use chrono::{FixedOffset, TimeZone, Timelike};
|
||||
use chrono_locale::LocaleDate;
|
||||
use chrono_lc::LocaleDate;
|
||||
|
||||
// This test is copied from chrono's, disabling unsupported features
|
||||
#[test]
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
extern crate chrono;
|
||||
extern crate chrono_locale;
|
||||
|
||||
use chrono::{FixedOffset, TimeZone, Timelike};
|
||||
use chrono_locale::LocaleDate;
|
||||
use chrono_lc::LocaleDate;
|
||||
|
||||
// This test is copied from chrono's, disabling unsupported features
|
||||
#[test]
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
extern crate chrono;
|
||||
extern crate chrono_locale;
|
||||
|
||||
use chrono::{FixedOffset, TimeZone, Timelike};
|
||||
use chrono_locale::LocaleDate;
|
||||
use chrono_lc::LocaleDate;
|
||||
|
||||
// This test is copied from chrono's, disabling unsupported features
|
||||
#[test]
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
extern crate chrono;
|
||||
extern crate chrono_locale;
|
||||
|
||||
use chrono::{FixedOffset, TimeZone, Timelike};
|
||||
use chrono_locale::LocaleDate;
|
||||
use chrono_lc::LocaleDate;
|
||||
|
||||
// This test is copied from chrono's, disabling unsupported features
|
||||
#[test]
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
extern crate chrono;
|
||||
extern crate chrono_locale;
|
||||
|
||||
use chrono::{FixedOffset, TimeZone, Timelike};
|
||||
use chrono_locale::LocaleDate;
|
||||
use chrono_lc::LocaleDate;
|
||||
|
||||
// This test is copied from chrono's, disabling unsupported features
|
||||
#[test]
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
extern crate chrono;
|
||||
extern crate chrono_locale;
|
||||
|
||||
use chrono::{FixedOffset, TimeZone, Timelike};
|
||||
use chrono_locale::LocaleDate;
|
||||
use chrono_lc::LocaleDate;
|
||||
|
||||
// This test is copied from chrono's, disabling unsupported features
|
||||
#[test]
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
extern crate chrono;
|
||||
extern crate chrono_locale;
|
||||
|
||||
use chrono::{FixedOffset, TimeZone, Timelike};
|
||||
use chrono_locale::LocaleDate;
|
||||
use chrono_lc::LocaleDate;
|
||||
|
||||
// This test is copied from chrono's, disabling unsupported features
|
||||
#[test]
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
extern crate chrono;
|
||||
extern crate chrono_locale;
|
||||
|
||||
use chrono::{FixedOffset, TimeZone, Timelike};
|
||||
use chrono_locale::LocaleDate;
|
||||
use chrono_lc::LocaleDate;
|
||||
|
||||
// This test is copied from chrono's, disabling unsupported features
|
||||
#[test]
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
extern crate chrono;
|
||||
extern crate chrono_locale;
|
||||
|
||||
use chrono::{FixedOffset, TimeZone, Timelike};
|
||||
use chrono_locale::LocaleDate;
|
||||
use chrono_lc::LocaleDate;
|
||||
|
||||
// This test is copied from chrono's, disabling unsupported features
|
||||
#[test]
|
||||
|
|
Loading…
Reference in a new issue