From 6d88a7e5c9f973765db3b3e6acbb09c56cde0340 Mon Sep 17 00:00:00 2001 From: Compey Date: Tue, 22 Aug 2023 21:58:28 +0530 Subject: [PATCH 01/62] feat: initial concept and 20% of implementation --- Cargo.lock | 86 +++++++++++++++ Cargo.toml | 1 + src/lune/builtins/date_time.rs | 123 ++++++++++++++++++++++ src/lune/lua/mod.rs | 1 + src/lune/lua/time/clock.rs | 187 +++++++++++++++++++++++++++++++++ src/lune/lua/time/mod.rs | 1 + 6 files changed, 399 insertions(+) create mode 100644 src/lune/builtins/date_time.rs create mode 100644 src/lune/lua/time/clock.rs create mode 100644 src/lune/lua/time/mod.rs diff --git a/Cargo.lock b/Cargo.lock index c7e42208..4c61b280 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -41,6 +41,21 @@ dependencies = [ "alloc-no-stdlib", ] +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + [[package]] name = "anstream" version = "0.3.2" @@ -294,6 +309,21 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "chrono" +version = "0.4.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "js-sys", + "num-traits", + "time 0.1.45", + "wasm-bindgen", + "winapi", +] + [[package]] name = "clap" version = "4.3.21" @@ -393,6 +423,12 @@ dependencies = [ "version_check", ] +[[package]] +name = "core-foundation-sys" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" + [[package]] name = "cpufeatures" version = "0.2.9" @@ -883,6 +919,29 @@ dependencies = [ "tungstenite", ] +[[package]] +name = "iana-time-zone" +version = "0.1.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + [[package]] name = "idna" version = "0.4.0" @@ -1033,6 +1092,7 @@ dependencies = [ "anyhow", "async-compression", "async-trait", + "chrono", "clap", "console", "dialoguer", @@ -2123,6 +2183,17 @@ dependencies = [ "syn 2.0.28", ] +[[package]] +name = "time" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" +dependencies = [ + "libc", + "wasi 0.10.0+wasi-snapshot-preview1", + "winapi", +] + [[package]] name = "time" version = "0.2.27" @@ -2471,6 +2542,12 @@ version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" +[[package]] +name = "wasi" +version = "0.10.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -2612,6 +2689,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +dependencies = [ + "windows-targets 0.48.1", +] + [[package]] name = "windows-sys" version = "0.45.0" diff --git a/Cargo.toml b/Cargo.toml index 0bc1d5c4..12b1c165 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -133,3 +133,4 @@ rbx_dom_weak = { optional = true, version = "2.5.0" } rbx_reflection = { optional = true, version = "4.3.0" } rbx_reflection_database = { optional = true, version = "0.2.7" } rbx_xml = { optional = true, version = "0.13.1" } +chrono = "0.4.26" diff --git a/src/lune/builtins/date_time.rs b/src/lune/builtins/date_time.rs new file mode 100644 index 00000000..fd2db010 --- /dev/null +++ b/src/lune/builtins/date_time.rs @@ -0,0 +1,123 @@ +use std::io::ErrorKind as IoErrorKind; +use std::path::{PathBuf, MAIN_SEPARATOR}; + +use mlua::prelude::*; +use tokio::fs; + +use crate::lune::lua::{ + fs::{copy, FsMetadata, FsWriteOptions}, + table::TableBuilder, +}; + +pub fn create(lua: &'static Lua) -> LuaResult { + TableBuilder::new(lua)? + .with_async_function("readFile", fs_read_file)? + .with_async_function("readDir", fs_read_dir)? + .with_async_function("writeFile", fs_write_file)? + .with_async_function("writeDir", fs_write_dir)? + .with_async_function("removeFile", fs_remove_file)? + .with_async_function("removeDir", fs_remove_dir)? + .with_async_function("metadata", fs_metadata)? + .with_async_function("isFile", fs_is_file)? + .with_async_function("isDir", fs_is_dir)? + .with_async_function("move", fs_move)? + .with_async_function("copy", fs_copy)? + .build_readonly() +} + +async fn fs_read_file(lua: &Lua, path: String) -> LuaResult { + let bytes = fs::read(&path).await.into_lua_err()?; + lua.create_string(bytes) +} + +async fn fs_read_dir(_: &Lua, path: String) -> LuaResult> { + let mut dir_strings = Vec::new(); + let mut dir = fs::read_dir(&path).await.into_lua_err()?; + while let Some(dir_entry) = dir.next_entry().await.into_lua_err()? { + if let Some(dir_path_str) = dir_entry.path().to_str() { + dir_strings.push(dir_path_str.to_owned()); + } else { + return Err(LuaError::RuntimeError(format!( + "File path could not be converted into a string: '{}'", + dir_entry.path().display() + ))); + } + } + let mut dir_string_prefix = path; + if !dir_string_prefix.ends_with(MAIN_SEPARATOR) { + dir_string_prefix.push(MAIN_SEPARATOR); + } + let dir_strings_no_prefix = dir_strings + .iter() + .map(|inner_path| { + inner_path + .trim() + .trim_start_matches(&dir_string_prefix) + .to_owned() + }) + .collect::>(); + Ok(dir_strings_no_prefix) +} + +async fn fs_write_file(_: &Lua, (path, contents): (String, LuaString<'_>)) -> LuaResult<()> { + fs::write(&path, &contents.as_bytes()).await.into_lua_err() +} + +async fn fs_write_dir(_: &Lua, path: String) -> LuaResult<()> { + fs::create_dir_all(&path).await.into_lua_err() +} + +async fn fs_remove_file(_: &Lua, path: String) -> LuaResult<()> { + fs::remove_file(&path).await.into_lua_err() +} + +async fn fs_remove_dir(_: &Lua, path: String) -> LuaResult<()> { + fs::remove_dir_all(&path).await.into_lua_err() +} + +async fn fs_metadata(_: &Lua, path: String) -> LuaResult { + match fs::metadata(path).await { + Err(e) if e.kind() == IoErrorKind::NotFound => Ok(FsMetadata::not_found()), + Ok(meta) => Ok(FsMetadata::from(meta)), + Err(e) => Err(e.into()), + } +} + +async fn fs_is_file(_: &Lua, path: String) -> LuaResult { + match fs::metadata(path).await { + Err(e) if e.kind() == IoErrorKind::NotFound => Ok(false), + Ok(meta) => Ok(meta.is_file()), + Err(e) => Err(e.into()), + } +} + +async fn fs_is_dir(_: &Lua, path: String) -> LuaResult { + match fs::metadata(path).await { + Err(e) if e.kind() == IoErrorKind::NotFound => Ok(false), + Ok(meta) => Ok(meta.is_dir()), + Err(e) => Err(e.into()), + } +} + +async fn fs_move(_: &Lua, (from, to, options): (String, String, FsWriteOptions)) -> LuaResult<()> { + let path_from = PathBuf::from(from); + if !path_from.exists() { + return Err(LuaError::RuntimeError(format!( + "No file or directory exists at the path '{}'", + path_from.display() + ))); + } + let path_to = PathBuf::from(to); + if !options.overwrite && path_to.exists() { + return Err(LuaError::RuntimeError(format!( + "A file or directory already exists at the path '{}'", + path_to.display() + ))); + } + fs::rename(path_from, path_to).await.into_lua_err()?; + Ok(()) +} + +async fn fs_copy(_: &Lua, (from, to, options): (String, String, FsWriteOptions)) -> LuaResult<()> { + copy(from, to, options).await +} diff --git a/src/lune/lua/mod.rs b/src/lune/lua/mod.rs index 944ea441..7bd037c9 100644 --- a/src/lune/lua/mod.rs +++ b/src/lune/lua/mod.rs @@ -9,5 +9,6 @@ pub mod serde; pub mod stdio; pub mod table; pub mod task; +pub mod time; pub use create::create as create_lune_lua; diff --git a/src/lune/lua/time/clock.rs b/src/lune/lua/time/clock.rs new file mode 100644 index 00000000..d41c5833 --- /dev/null +++ b/src/lune/lua/time/clock.rs @@ -0,0 +1,187 @@ +use anyhow::Result; +use chrono::prelude::*; + +// TODO: Proper error handing and stuff + +pub enum TimestampType { + Seconds, + Millis, +} + +pub struct Clock { + pub unix_timestamp: i64, + pub unix_timestamp_millis: i64, +} + +impl Clock { + /// Returns a DateTime representing the current moment in time + pub fn now() -> Self { + let time = Utc::now(); + + Self { + unix_timestamp: time.timestamp(), + unix_timestamp_millis: time.timestamp_millis(), + } + } + + /// Returns a new DateTime object from the given unix timestamp, in either seconds on + /// milliseconds. In case of failure, defaults to the (seconds or + /// milliseconds) since January 1st, 1970 at 00:00 (UTC) + pub fn from_unix_timestamp(timestamp_kind: TimestampType, unix_timestamp: i64) -> Self { + let time_chrono = match timestamp_kind { + TimestampType::Seconds => NaiveDateTime::from_timestamp_opt(unix_timestamp, 0), + TimestampType::Millis => NaiveDateTime::from_timestamp_millis(unix_timestamp), + }; + + if let Some(time) = time_chrono { + Self { + unix_timestamp: time.timestamp(), + unix_timestamp_millis: time.timestamp_millis(), + } + } else { + Self::now() + } + } + + pub fn from_local_time(date_time: Option) -> Self { + if let Some(date_time) = date_time { + let local_time: DateTime = Local + .from_local_datetime(&NaiveDateTime::new( + NaiveDate::from_ymd_opt(date_time.year, date_time.month, date_time.day) + .expect("invalid date"), + NaiveTime::from_hms_milli_opt( + date_time.hour, + date_time.minute, + date_time.second, + date_time.millisecond, + ) + .expect("invalid time"), + )) + .unwrap(); + + Self { + unix_timestamp: local_time.timestamp(), + unix_timestamp_millis: local_time.timestamp_millis(), + } + } else { + let local_time = Local::now(); + + Self { + unix_timestamp: local_time.timestamp(), + unix_timestamp_millis: local_time.timestamp_millis(), + } + } + } + + pub fn from_iso_date(iso_date: T) -> Self + where + T: ToString, + { + let time = DateTime::parse_from_str(iso_date.to_string().as_str(), "%Y-%m-%dT%H:%M:%SZ") + .expect("invalid ISO 8601 string"); + + Self { + unix_timestamp: time.timestamp(), + unix_timestamp_millis: time.timestamp_millis(), + } + } +} + +pub struct DateTimeConstructor { + year: i32, + month: u32, + day: u32, + hour: u32, + minute: u32, + second: u32, + millisecond: u32, +} + +impl Default for DateTimeConstructor { + /// Constructs the default state for DateTimeConstructor, which is the Unix Epoch. + fn default() -> Self { + Self { + year: 1970, + month: 1, + day: 1, + hour: 0, + minute: 0, + second: 0, + millisecond: 0, + } + } +} + +pub enum Month { + January, + February, + March, + April, + May, + June, + July, + August, + September, + October, + November, + December, +} + +impl DateTimeConstructor { + pub fn with_year(&mut self, year: i32) -> &Self { + self.year = year; + + self + } + + pub fn with_month(&mut self, month: Month) -> &Self { + let month = match month { + Month::January => 1, + Month::February => 2, + Month::March => 3, + Month::April => 4, + Month::May => 5, + Month::June => 6, + Month::July => 7, + Month::August => 8, + Month::September => 9, + Month::October => 10, + Month::November => 11, + Month::December => 12, + }; + + self.month = month; + + self + } + + pub fn with_day(&mut self, day: u32) -> &Self { + self.day = day; + + self + } + + pub fn with_hour(&mut self, hour: u32) -> &Self { + self.hour = hour; + + self + } + + pub fn with_minute(&mut self, minute: u32) -> &Self { + self.minute = minute; + + self + } + + pub fn with_second(&mut self, second: u32) -> &Self { + self.second = second; + + self + } + + pub fn with_millisecond(&mut self, millisecond: u32) -> &Self { + self.millisecond = millisecond; + + self + } +} diff --git a/src/lune/lua/time/mod.rs b/src/lune/lua/time/mod.rs new file mode 100644 index 00000000..159730d2 --- /dev/null +++ b/src/lune/lua/time/mod.rs @@ -0,0 +1 @@ +pub mod clock; From 5df5f104805d049c1cb818a04f15843b2a9b9d0a Mon Sep 17 00:00:00 2001 From: Compey Date: Tue, 22 Aug 2023 22:06:57 +0530 Subject: [PATCH 02/62] fix: rename Clock -> DateTime --- src/lune/builtins/date_time.rs | 256 ++++++++++++++++++++------------- src/lune/builtins/mod.rs | 1 + src/lune/lua/mod.rs | 1 - src/lune/lua/time/clock.rs | 187 ------------------------ src/lune/lua/time/mod.rs | 1 - 5 files changed, 161 insertions(+), 285 deletions(-) delete mode 100644 src/lune/lua/time/clock.rs delete mode 100644 src/lune/lua/time/mod.rs diff --git a/src/lune/builtins/date_time.rs b/src/lune/builtins/date_time.rs index fd2db010..454291e7 100644 --- a/src/lune/builtins/date_time.rs +++ b/src/lune/builtins/date_time.rs @@ -1,123 +1,187 @@ -use std::io::ErrorKind as IoErrorKind; -use std::path::{PathBuf, MAIN_SEPARATOR}; - -use mlua::prelude::*; -use tokio::fs; - -use crate::lune::lua::{ - fs::{copy, FsMetadata, FsWriteOptions}, - table::TableBuilder, -}; - -pub fn create(lua: &'static Lua) -> LuaResult { - TableBuilder::new(lua)? - .with_async_function("readFile", fs_read_file)? - .with_async_function("readDir", fs_read_dir)? - .with_async_function("writeFile", fs_write_file)? - .with_async_function("writeDir", fs_write_dir)? - .with_async_function("removeFile", fs_remove_file)? - .with_async_function("removeDir", fs_remove_dir)? - .with_async_function("metadata", fs_metadata)? - .with_async_function("isFile", fs_is_file)? - .with_async_function("isDir", fs_is_dir)? - .with_async_function("move", fs_move)? - .with_async_function("copy", fs_copy)? - .build_readonly() +use anyhow::Result; +use chrono::prelude::*; + +// TODO: Proper error handling and stuff + +pub enum TimestampType { + Seconds, + Millis, } -async fn fs_read_file(lua: &Lua, path: String) -> LuaResult { - let bytes = fs::read(&path).await.into_lua_err()?; - lua.create_string(bytes) +pub struct DateTime { + pub unix_timestamp: i64, + pub unix_timestamp_millis: i64, } -async fn fs_read_dir(_: &Lua, path: String) -> LuaResult> { - let mut dir_strings = Vec::new(); - let mut dir = fs::read_dir(&path).await.into_lua_err()?; - while let Some(dir_entry) = dir.next_entry().await.into_lua_err()? { - if let Some(dir_path_str) = dir_entry.path().to_str() { - dir_strings.push(dir_path_str.to_owned()); +impl DateTime { + /// Returns a DateTime representing the current moment in time + pub fn now() -> Self { + let time = Utc::now(); + + Self { + unix_timestamp: time.timestamp(), + unix_timestamp_millis: time.timestamp_millis(), + } + } + + /// Returns a new DateTime object from the given unix timestamp, in either seconds on + /// milliseconds. In case of failure, defaults to the (seconds or + /// milliseconds) since January 1st, 1970 at 00:00 (UTC) + pub fn from_unix_timestamp(timestamp_kind: TimestampType, unix_timestamp: i64) -> Self { + let time_chrono = match timestamp_kind { + TimestampType::Seconds => NaiveDateTime::from_timestamp_opt(unix_timestamp, 0), + TimestampType::Millis => NaiveDateTime::from_timestamp_millis(unix_timestamp), + }; + + if let Some(time) = time_chrono { + Self { + unix_timestamp: time.timestamp(), + unix_timestamp_millis: time.timestamp_millis(), + } } else { - return Err(LuaError::RuntimeError(format!( - "File path could not be converted into a string: '{}'", - dir_entry.path().display() - ))); + Self::now() } } - let mut dir_string_prefix = path; - if !dir_string_prefix.ends_with(MAIN_SEPARATOR) { - dir_string_prefix.push(MAIN_SEPARATOR); + + pub fn from_local_time(date_time: Option) -> Self { + if let Some(date_time) = date_time { + let local_time: DateTime = Local + .from_local_datetime(&NaiveDateTime::new( + NaiveDate::from_ymd_opt(date_time.year, date_time.month, date_time.day) + .expect("invalid date"), + NaiveTime::from_hms_milli_opt( + date_time.hour, + date_time.minute, + date_time.second, + date_time.millisecond, + ) + .expect("invalid time"), + )) + .unwrap(); + + Self { + unix_timestamp: local_time.timestamp(), + unix_timestamp_millis: local_time.timestamp_millis(), + } + } else { + let local_time = Local::now(); + + Self { + unix_timestamp: local_time.timestamp(), + unix_timestamp_millis: local_time.timestamp_millis(), + } + } } - let dir_strings_no_prefix = dir_strings - .iter() - .map(|inner_path| { - inner_path - .trim() - .trim_start_matches(&dir_string_prefix) - .to_owned() - }) - .collect::>(); - Ok(dir_strings_no_prefix) -} -async fn fs_write_file(_: &Lua, (path, contents): (String, LuaString<'_>)) -> LuaResult<()> { - fs::write(&path, &contents.as_bytes()).await.into_lua_err() + pub fn from_iso_date(iso_date: T) -> Self + where + T: ToString, + { + let time = DateTime::parse_from_str(iso_date.to_string().as_str(), "%Y-%m-%dT%H:%M:%SZ") + .expect("invalid ISO 8601 string"); + + Self { + unix_timestamp: time.timestamp(), + unix_timestamp_millis: time.timestamp_millis(), + } + } } -async fn fs_write_dir(_: &Lua, path: String) -> LuaResult<()> { - fs::create_dir_all(&path).await.into_lua_err() +pub struct DateTimeConstructor { + year: i32, + month: u32, + day: u32, + hour: u32, + minute: u32, + second: u32, + millisecond: u32, } -async fn fs_remove_file(_: &Lua, path: String) -> LuaResult<()> { - fs::remove_file(&path).await.into_lua_err() +impl Default for DateTimeConstructor { + /// Constructs the default state for DateTimeConstructor, which is the Unix Epoch. + fn default() -> Self { + Self { + year: 1970, + month: 1, + day: 1, + hour: 0, + minute: 0, + second: 0, + millisecond: 0, + } + } } -async fn fs_remove_dir(_: &Lua, path: String) -> LuaResult<()> { - fs::remove_dir_all(&path).await.into_lua_err() +pub enum Month { + January, + February, + March, + April, + May, + June, + July, + August, + September, + October, + November, + December, } -async fn fs_metadata(_: &Lua, path: String) -> LuaResult { - match fs::metadata(path).await { - Err(e) if e.kind() == IoErrorKind::NotFound => Ok(FsMetadata::not_found()), - Ok(meta) => Ok(FsMetadata::from(meta)), - Err(e) => Err(e.into()), +impl DateTimeConstructor { + pub fn with_year(&mut self, year: i32) -> &Self { + self.year = year; + + self } -} -async fn fs_is_file(_: &Lua, path: String) -> LuaResult { - match fs::metadata(path).await { - Err(e) if e.kind() == IoErrorKind::NotFound => Ok(false), - Ok(meta) => Ok(meta.is_file()), - Err(e) => Err(e.into()), + pub fn with_month(&mut self, month: Month) -> &Self { + let month = match month { + Month::January => 1, + Month::February => 2, + Month::March => 3, + Month::April => 4, + Month::May => 5, + Month::June => 6, + Month::July => 7, + Month::August => 8, + Month::September => 9, + Month::October => 10, + Month::November => 11, + Month::December => 12, + }; + + self.month = month; + + self } -} -async fn fs_is_dir(_: &Lua, path: String) -> LuaResult { - match fs::metadata(path).await { - Err(e) if e.kind() == IoErrorKind::NotFound => Ok(false), - Ok(meta) => Ok(meta.is_dir()), - Err(e) => Err(e.into()), + pub fn with_day(&mut self, day: u32) -> &Self { + self.day = day; + + self } -} -async fn fs_move(_: &Lua, (from, to, options): (String, String, FsWriteOptions)) -> LuaResult<()> { - let path_from = PathBuf::from(from); - if !path_from.exists() { - return Err(LuaError::RuntimeError(format!( - "No file or directory exists at the path '{}'", - path_from.display() - ))); + pub fn with_hour(&mut self, hour: u32) -> &Self { + self.hour = hour; + + self } - let path_to = PathBuf::from(to); - if !options.overwrite && path_to.exists() { - return Err(LuaError::RuntimeError(format!( - "A file or directory already exists at the path '{}'", - path_to.display() - ))); + + pub fn with_minute(&mut self, minute: u32) -> &Self { + self.minute = minute; + + self } - fs::rename(path_from, path_to).await.into_lua_err()?; - Ok(()) -} -async fn fs_copy(_: &Lua, (from, to, options): (String, String, FsWriteOptions)) -> LuaResult<()> { - copy(from, to, options).await + pub fn with_second(&mut self, second: u32) -> &Self { + self.second = second; + + self + } + + pub fn with_millisecond(&mut self, millisecond: u32) -> &Self { + self.millisecond = millisecond; + + self + } } diff --git a/src/lune/builtins/mod.rs b/src/lune/builtins/mod.rs index 46aefbe5..312305df 100644 --- a/src/lune/builtins/mod.rs +++ b/src/lune/builtins/mod.rs @@ -6,6 +6,7 @@ pub mod serde; pub mod stdio; pub mod task; pub mod top_level; +pub mod date_time; #[cfg(feature = "roblox")] pub mod roblox; diff --git a/src/lune/lua/mod.rs b/src/lune/lua/mod.rs index 7bd037c9..944ea441 100644 --- a/src/lune/lua/mod.rs +++ b/src/lune/lua/mod.rs @@ -9,6 +9,5 @@ pub mod serde; pub mod stdio; pub mod table; pub mod task; -pub mod time; pub use create::create as create_lune_lua; diff --git a/src/lune/lua/time/clock.rs b/src/lune/lua/time/clock.rs deleted file mode 100644 index d41c5833..00000000 --- a/src/lune/lua/time/clock.rs +++ /dev/null @@ -1,187 +0,0 @@ -use anyhow::Result; -use chrono::prelude::*; - -// TODO: Proper error handing and stuff - -pub enum TimestampType { - Seconds, - Millis, -} - -pub struct Clock { - pub unix_timestamp: i64, - pub unix_timestamp_millis: i64, -} - -impl Clock { - /// Returns a DateTime representing the current moment in time - pub fn now() -> Self { - let time = Utc::now(); - - Self { - unix_timestamp: time.timestamp(), - unix_timestamp_millis: time.timestamp_millis(), - } - } - - /// Returns a new DateTime object from the given unix timestamp, in either seconds on - /// milliseconds. In case of failure, defaults to the (seconds or - /// milliseconds) since January 1st, 1970 at 00:00 (UTC) - pub fn from_unix_timestamp(timestamp_kind: TimestampType, unix_timestamp: i64) -> Self { - let time_chrono = match timestamp_kind { - TimestampType::Seconds => NaiveDateTime::from_timestamp_opt(unix_timestamp, 0), - TimestampType::Millis => NaiveDateTime::from_timestamp_millis(unix_timestamp), - }; - - if let Some(time) = time_chrono { - Self { - unix_timestamp: time.timestamp(), - unix_timestamp_millis: time.timestamp_millis(), - } - } else { - Self::now() - } - } - - pub fn from_local_time(date_time: Option) -> Self { - if let Some(date_time) = date_time { - let local_time: DateTime = Local - .from_local_datetime(&NaiveDateTime::new( - NaiveDate::from_ymd_opt(date_time.year, date_time.month, date_time.day) - .expect("invalid date"), - NaiveTime::from_hms_milli_opt( - date_time.hour, - date_time.minute, - date_time.second, - date_time.millisecond, - ) - .expect("invalid time"), - )) - .unwrap(); - - Self { - unix_timestamp: local_time.timestamp(), - unix_timestamp_millis: local_time.timestamp_millis(), - } - } else { - let local_time = Local::now(); - - Self { - unix_timestamp: local_time.timestamp(), - unix_timestamp_millis: local_time.timestamp_millis(), - } - } - } - - pub fn from_iso_date(iso_date: T) -> Self - where - T: ToString, - { - let time = DateTime::parse_from_str(iso_date.to_string().as_str(), "%Y-%m-%dT%H:%M:%SZ") - .expect("invalid ISO 8601 string"); - - Self { - unix_timestamp: time.timestamp(), - unix_timestamp_millis: time.timestamp_millis(), - } - } -} - -pub struct DateTimeConstructor { - year: i32, - month: u32, - day: u32, - hour: u32, - minute: u32, - second: u32, - millisecond: u32, -} - -impl Default for DateTimeConstructor { - /// Constructs the default state for DateTimeConstructor, which is the Unix Epoch. - fn default() -> Self { - Self { - year: 1970, - month: 1, - day: 1, - hour: 0, - minute: 0, - second: 0, - millisecond: 0, - } - } -} - -pub enum Month { - January, - February, - March, - April, - May, - June, - July, - August, - September, - October, - November, - December, -} - -impl DateTimeConstructor { - pub fn with_year(&mut self, year: i32) -> &Self { - self.year = year; - - self - } - - pub fn with_month(&mut self, month: Month) -> &Self { - let month = match month { - Month::January => 1, - Month::February => 2, - Month::March => 3, - Month::April => 4, - Month::May => 5, - Month::June => 6, - Month::July => 7, - Month::August => 8, - Month::September => 9, - Month::October => 10, - Month::November => 11, - Month::December => 12, - }; - - self.month = month; - - self - } - - pub fn with_day(&mut self, day: u32) -> &Self { - self.day = day; - - self - } - - pub fn with_hour(&mut self, hour: u32) -> &Self { - self.hour = hour; - - self - } - - pub fn with_minute(&mut self, minute: u32) -> &Self { - self.minute = minute; - - self - } - - pub fn with_second(&mut self, second: u32) -> &Self { - self.second = second; - - self - } - - pub fn with_millisecond(&mut self, millisecond: u32) -> &Self { - self.millisecond = millisecond; - - self - } -} diff --git a/src/lune/lua/time/mod.rs b/src/lune/lua/time/mod.rs deleted file mode 100644 index 159730d2..00000000 --- a/src/lune/lua/time/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod clock; From 5ccab5b15a5641cbc637537a755a4a9f2a419e30 Mon Sep 17 00:00:00 2001 From: Compey Date: Tue, 22 Aug 2023 22:12:04 +0530 Subject: [PATCH 03/62] fix: cargo build --- src/lune/builtins/date_time.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lune/builtins/date_time.rs b/src/lune/builtins/date_time.rs index 454291e7..8754c7e0 100644 --- a/src/lune/builtins/date_time.rs +++ b/src/lune/builtins/date_time.rs @@ -1,5 +1,5 @@ -use anyhow::Result; use chrono::prelude::*; +use chrono::DateTime as ChronoDateTime; // TODO: Proper error handling and stuff @@ -45,7 +45,7 @@ impl DateTime { pub fn from_local_time(date_time: Option) -> Self { if let Some(date_time) = date_time { - let local_time: DateTime = Local + let local_time: ChronoDateTime = Local .from_local_datetime(&NaiveDateTime::new( NaiveDate::from_ymd_opt(date_time.year, date_time.month, date_time.day) .expect("invalid date"), @@ -77,7 +77,7 @@ impl DateTime { where T: ToString, { - let time = DateTime::parse_from_str(iso_date.to_string().as_str(), "%Y-%m-%dT%H:%M:%SZ") + let time = ChronoDateTime::parse_from_str(iso_date.to_string().as_str(), "%Y-%m-%dT%H:%M:%SZ") .expect("invalid ISO 8601 string"); Self { From a53927b66bcc0955634c7a58a8a1e2cb09bbc0f0 Mon Sep 17 00:00:00 2001 From: Compey Date: Wed, 23 Aug 2023 00:20:00 +0530 Subject: [PATCH 04/62] feat: converstion method implementations * to_datetime_constructor (internal): converts DateTime to DateTimeConstructor * to_local_time: converts DateTime to DateTimeConstructor with local timezone * to_universal_time: converts DateTime to DateTimeConstructor with UTC timezone * to_iso_date: converts DateTime to UTC ISO 8601 string --- src/lune/builtins/date_time.rs | 164 ++++++++++++++++++++++++++++----- 1 file changed, 139 insertions(+), 25 deletions(-) diff --git a/src/lune/builtins/date_time.rs b/src/lune/builtins/date_time.rs index 8754c7e0..5538a30e 100644 --- a/src/lune/builtins/date_time.rs +++ b/src/lune/builtins/date_time.rs @@ -43,6 +43,34 @@ impl DateTime { } } + pub fn from_universal_time(date_time: Option) -> Self { + if let Some(date_time) = date_time { + let utc_time: ChronoDateTime = Utc.from_utc_datetime(&NaiveDateTime::new( + NaiveDate::from_ymd_opt(date_time.year, date_time.month, date_time.day) + .expect("invalid date"), + NaiveTime::from_hms_milli_opt( + date_time.hour, + date_time.minute, + date_time.second, + date_time.millisecond, + ) + .expect("invalid time"), + )); + + Self { + unix_timestamp: utc_time.timestamp(), + unix_timestamp_millis: utc_time.timestamp_millis(), + } + } else { + let utc_time = Utc::now(); + + Self { + unix_timestamp: utc_time.timestamp(), + unix_timestamp_millis: utc_time.timestamp_millis(), + } + } + } + pub fn from_local_time(date_time: Option) -> Self { if let Some(date_time) = date_time { let local_time: ChronoDateTime = Local @@ -77,14 +105,61 @@ impl DateTime { where T: ToString, { - let time = ChronoDateTime::parse_from_str(iso_date.to_string().as_str(), "%Y-%m-%dT%H:%M:%SZ") - .expect("invalid ISO 8601 string"); + let time = + ChronoDateTime::parse_from_str(iso_date.to_string().as_str(), "%Y-%m-%dT%H:%M:%SZ") + .expect("invalid ISO 8601 string"); Self { unix_timestamp: time.timestamp(), unix_timestamp_millis: time.timestamp_millis(), } } + + fn to_datetime_constructor(date_time: ChronoDateTime) -> DateTimeConstructor + where + T: TimeZone, + { + let mut date_time_constructor = DateTimeConstructor::default(); + + // Any less tedious way to get Enum member based on index? + // I know there's some crates available with derive macros for this, + // would it be okay if used some of them? + date_time_constructor + .with_year(date_time.year()) + .with_month(match date_time.month() { + 1 => Month::January, + 2 => Month::February, + 3 => Month::March, + 4 => Month::April, + 5 => Month::May, + 6 => Month::June, + 7 => Month::July, + 8 => Month::August, + 9 => Month::September, + 10 => Month::October, + 11 => Month::November, + 12 => Month::December, + _ => panic!("invalid month ordinal"), + }) + .with_day(date_time.day()) + .with_hour(date_time.hour()) + .with_minute(date_time.minute()) + .with_second(date_time.second()); + + date_time_constructor + } + + pub fn to_local_time(&self) -> DateTimeConstructor { + Self::to_datetime_constructor(Local.timestamp_opt(self.unix_timestamp, 0).unwrap()) + } + + pub fn to_universal_time(&self) -> DateTimeConstructor { + Self::to_datetime_constructor(Utc.timestamp_opt(self.unix_timestamp, 0).unwrap()) + } + + pub fn to_iso_date(&self) -> String { + self.to_universal_time().to_iso_string(Timezone::UTC) + } } pub struct DateTimeConstructor { @@ -112,6 +187,7 @@ impl Default for DateTimeConstructor { } } +#[derive(PartialEq, Eq, PartialOrd, Ord)] pub enum Month { January, February, @@ -127,61 +203,99 @@ pub enum Month { December, } +// fn match_month_to_num(month: Month) { +// match month { +// Month::January => 1, +// Month::February => 2, +// Month::March => 3, +// Month::April => 4, +// Month::May => 5, +// Month::June => 6, +// Month::July => 7, +// Month::August => 8, +// Month::September => 9, +// Month::October => 10, +// Month::November => 11, +// Month::December => 12, +// }; +// } + +enum Timezone { + UTC, + Local, +} + impl DateTimeConstructor { - pub fn with_year(&mut self, year: i32) -> &Self { + pub fn with_year(&mut self, year: i32) -> &mut Self { self.year = year; self } - pub fn with_month(&mut self, month: Month) -> &Self { - let month = match month { - Month::January => 1, - Month::February => 2, - Month::March => 3, - Month::April => 4, - Month::May => 5, - Month::June => 6, - Month::July => 7, - Month::August => 8, - Month::September => 9, - Month::October => 10, - Month::November => 11, - Month::December => 12, - }; - - self.month = month; + pub fn with_month(&mut self, month: Month) -> &mut Self { + self.month = month as u32; self } - pub fn with_day(&mut self, day: u32) -> &Self { + pub fn with_day(&mut self, day: u32) -> &mut Self { self.day = day; self } - pub fn with_hour(&mut self, hour: u32) -> &Self { + pub fn with_hour(&mut self, hour: u32) -> &mut Self { self.hour = hour; self } - pub fn with_minute(&mut self, minute: u32) -> &Self { + pub fn with_minute(&mut self, minute: u32) -> &mut Self { self.minute = minute; self } - pub fn with_second(&mut self, second: u32) -> &Self { + pub fn with_second(&mut self, second: u32) -> &mut Self { self.second = second; self } - pub fn with_millisecond(&mut self, millisecond: u32) -> &Self { + pub fn with_millisecond(&mut self, millisecond: u32) -> &mut Self { self.millisecond = millisecond; self } + + fn to_iso_string(&self, timezone: Timezone) -> String { + let iso_format = "%Y-%m-%dT%H:%M:%SZ"; + + match timezone { + Timezone::UTC => Utc + .with_ymd_and_hms( + self.year, + self.month, + self.day, + self.hour, + self.minute, + self.second, + ) + .unwrap() + .format(iso_format) + .to_string(), + Timezone::Local => Local + .with_ymd_and_hms( + self.year, + self.month, + self.day, + self.hour, + self.minute, + self.second, + ) + .unwrap() + .format(iso_format) + .to_string(), + } + } } From 40b14945365bd0c70508a716759c05c5c72e667e Mon Sep 17 00:00:00 2001 From: Compey Date: Wed, 23 Aug 2023 18:18:42 +0530 Subject: [PATCH 05/62] refactor: minor changes --- Cargo.toml | 4 +- src/lune/builtins/date_time.rs | 69 +++++++++++++++------------------- 2 files changed, 34 insertions(+), 39 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 12b1c165..43cfd4f5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -107,6 +107,9 @@ reqwest = { version = "0.11", default-features = false, features = [ ] } tokio-tungstenite = { version = "0.20", features = ["rustls-tls-webpki-roots"] } +### DATETIME +chrono = "0.4.26" + ### CLI anyhow = { optional = true, version = "1.0" } @@ -133,4 +136,3 @@ rbx_dom_weak = { optional = true, version = "2.5.0" } rbx_reflection = { optional = true, version = "4.3.0" } rbx_reflection_database = { optional = true, version = "0.2.7" } rbx_xml = { optional = true, version = "0.13.1" } -chrono = "0.4.26" diff --git a/src/lune/builtins/date_time.rs b/src/lune/builtins/date_time.rs index 5538a30e..05846f83 100644 --- a/src/lune/builtins/date_time.rs +++ b/src/lune/builtins/date_time.rs @@ -1,5 +1,6 @@ use chrono::prelude::*; use chrono::DateTime as ChronoDateTime; +use once_cell::sync::Lazy; // TODO: Proper error handling and stuff @@ -158,7 +159,23 @@ impl DateTime { } pub fn to_iso_date(&self) -> String { - self.to_universal_time().to_iso_string(Timezone::UTC) + self.to_universal_time() + .to_string::<&str>(Timezone::UTC, None) + } + + // TODO: Implement localization + // There seems to be only one localization crate for chrono, + // which has been committed to last 5 years ago. Thus, this crate doesn't + // work with the version of chrono we're using. I'll be forking this crate + // and making it compatible with our version of chrono for now. + pub fn format_universal_time(&self, fmt_str: T, locale: T) -> String + where + T: ToString, + { + let format = fmt_str.to_string(); + + self.to_universal_time() + .to_string(Timezone::UTC, Some(format)) } } @@ -187,39 +204,6 @@ impl Default for DateTimeConstructor { } } -#[derive(PartialEq, Eq, PartialOrd, Ord)] -pub enum Month { - January, - February, - March, - April, - May, - June, - July, - August, - September, - October, - November, - December, -} - -// fn match_month_to_num(month: Month) { -// match month { -// Month::January => 1, -// Month::February => 2, -// Month::March => 3, -// Month::April => 4, -// Month::May => 5, -// Month::June => 6, -// Month::July => 7, -// Month::August => 8, -// Month::September => 9, -// Month::October => 10, -// Month::November => 11, -// Month::December => 12, -// }; -// } - enum Timezone { UTC, Local, @@ -268,8 +252,17 @@ impl DateTimeConstructor { self } - fn to_iso_string(&self, timezone: Timezone) -> String { - let iso_format = "%Y-%m-%dT%H:%M:%SZ"; + fn to_string(&self, timezone: Timezone, format: Option) -> String + where + T: ToString, + { + let format_lazy: Lazy = Lazy::new(|| { + if let Some(fmt) = format { + fmt.to_string() + } else { + "%Y-%m-%dT%H:%M:%SZ".to_string() + } + }); match timezone { Timezone::UTC => Utc @@ -282,7 +275,7 @@ impl DateTimeConstructor { self.second, ) .unwrap() - .format(iso_format) + .format((*format_lazy).as_str()) .to_string(), Timezone::Local => Local .with_ymd_and_hms( @@ -294,7 +287,7 @@ impl DateTimeConstructor { self.second, ) .unwrap() - .format(iso_format) + .format((*format_lazy).as_str()) .to_string(), } } From 2efc0be6f7d87125f4da78a332252b18d63b6c4f Mon Sep 17 00:00:00 2001 From: Compey Date: Wed, 23 Aug 2023 19:05:01 +0530 Subject: [PATCH 06/62] feat: finish DateTime implementation * format_time: formats the current DateTime to a string with a specified locale and timezone --- Cargo.lock | 44 +++++++++++++++++++++++++++++ Cargo.toml | 1 + src/lune/builtins/date_time.rs | 51 +++++++++++++++++++++------------- 3 files changed, 76 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4c61b280..b0003cad 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -324,6 +324,20 @@ dependencies = [ "winapi", ] +[[package]] +name = "chrono_locale" +version = "0.1.1" +source = "git+https://github.com/0x5eal/chrono-locale.git?rev=ff1df09#ff1df090a1bc55574ffe2bb4c04014ba017c6f36" +dependencies = [ + "chrono", + "lazy_static", + "num-integer", + "serde", + "serde_derive", + "serde_json", + "walkdir", +] + [[package]] name = "clap" version = "4.3.21" @@ -1093,6 +1107,7 @@ dependencies = [ "async-compression", "async-trait", "chrono", + "chrono_locale", "clap", "console", "dialoguer", @@ -1240,6 +1255,16 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", +] + [[package]] name = "num-traits" version = "0.2.16" @@ -1848,6 +1873,15 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + [[package]] name = "scopeguard" version = "1.2.0" @@ -2527,6 +2561,16 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "walkdir" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" +dependencies = [ + "same-file", + "winapi-util", +] + [[package]] name = "want" version = "0.3.1" diff --git a/Cargo.toml b/Cargo.toml index 43cfd4f5..042d56a5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -109,6 +109,7 @@ tokio-tungstenite = { version = "0.20", features = ["rustls-tls-webpki-roots"] } ### DATETIME chrono = "0.4.26" +chrono_locale = { git = "https://github.com/0x5eal/chrono-locale.git", rev = "ff1df09" } ### CLI diff --git a/src/lune/builtins/date_time.rs b/src/lune/builtins/date_time.rs index 05846f83..6c372881 100644 --- a/src/lune/builtins/date_time.rs +++ b/src/lune/builtins/date_time.rs @@ -1,5 +1,6 @@ use chrono::prelude::*; use chrono::DateTime as ChronoDateTime; +use chrono_locale::LocaleDate; use once_cell::sync::Lazy; // TODO: Proper error handling and stuff @@ -160,33 +161,35 @@ impl DateTime { pub fn to_iso_date(&self) -> String { self.to_universal_time() - .to_string::<&str>(Timezone::UTC, None) + .to_string::<&str>(Timezone::UTC, None, None) } - // TODO: Implement localization // There seems to be only one localization crate for chrono, // which has been committed to last 5 years ago. Thus, this crate doesn't - // work with the version of chrono we're using. I'll be forking this crate - // and making it compatible with our version of chrono for now. - pub fn format_universal_time(&self, fmt_str: T, locale: T) -> String + // work with the version of chrono we're using. I've forked the crate + // and have made it compatible with the latest version of chrono. + + // TODO: Implement more locales for chrono-locale. + pub fn format_time(&self, timezone: Timezone, fmt_str: T, locale: T) -> String where T: ToString, { - let format = fmt_str.to_string(); - - self.to_universal_time() - .to_string(Timezone::UTC, Some(format)) + self.to_universal_time().to_string( + timezone, + Some(fmt_str.to_string()), + Some(locale.to_string()), + ) } } pub struct DateTimeConstructor { - year: i32, - month: u32, - day: u32, - hour: u32, - minute: u32, - second: u32, - millisecond: u32, + pub year: i32, + pub month: u32, + pub day: u32, + pub hour: u32, + pub minute: u32, + pub second: u32, + pub millisecond: u32, } impl Default for DateTimeConstructor { @@ -204,7 +207,7 @@ impl Default for DateTimeConstructor { } } -enum Timezone { +pub enum Timezone { UTC, Local, } @@ -252,7 +255,7 @@ impl DateTimeConstructor { self } - fn to_string(&self, timezone: Timezone, format: Option) -> String + fn to_string(&self, timezone: Timezone, format: Option, locale: Option) -> String where T: ToString, { @@ -264,6 +267,14 @@ impl DateTimeConstructor { } }); + let locale_lazy: Lazy = Lazy::new(|| { + if let Some(locale) = locale { + locale.to_string() + } else { + "en".to_string() + } + }); + match timezone { Timezone::UTC => Utc .with_ymd_and_hms( @@ -275,7 +286,7 @@ impl DateTimeConstructor { self.second, ) .unwrap() - .format((*format_lazy).as_str()) + .formatl((*format_lazy).as_str(), (*locale_lazy).as_str()) .to_string(), Timezone::Local => Local .with_ymd_and_hms( @@ -287,7 +298,7 @@ impl DateTimeConstructor { self.second, ) .unwrap() - .format((*format_lazy).as_str()) + .formatl((*format_lazy).as_str(), (*locale_lazy).as_str()) .to_string(), } } From 80341ce874acf50790c800c697fa4fad46829feb Mon Sep 17 00:00:00 2001 From: Compey Date: Wed, 23 Aug 2023 19:11:05 +0530 Subject: [PATCH 07/62] chore(deps): bump chrono_locale rev --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b0003cad..7d4e84f4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -327,7 +327,7 @@ dependencies = [ [[package]] name = "chrono_locale" version = "0.1.1" -source = "git+https://github.com/0x5eal/chrono-locale.git?rev=ff1df09#ff1df090a1bc55574ffe2bb4c04014ba017c6f36" +source = "git+https://github.com/0x5eal/chrono-locale.git?rev=2a7ebcc#2a7ebcc019d133bc17833d66731092dee60dc3b7" dependencies = [ "chrono", "lazy_static", diff --git a/Cargo.toml b/Cargo.toml index 042d56a5..d5966155 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -109,7 +109,7 @@ tokio-tungstenite = { version = "0.20", features = ["rustls-tls-webpki-roots"] } ### DATETIME chrono = "0.4.26" -chrono_locale = { git = "https://github.com/0x5eal/chrono-locale.git", rev = "ff1df09" } +chrono_locale = { git = "https://github.com/0x5eal/chrono-locale.git", rev = "2a7ebcc" } ### CLI From fa4ccc138ad3b620101d2545d5941638f6e352a0 Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Wed, 23 Aug 2023 21:06:00 +0530 Subject: [PATCH 08/62] chore(deps): update chrono_locale --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index d5966155..098094d8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -109,7 +109,7 @@ tokio-tungstenite = { version = "0.20", features = ["rustls-tls-webpki-roots"] } ### DATETIME chrono = "0.4.26" -chrono_locale = { git = "https://github.com/0x5eal/chrono-locale.git", rev = "2a7ebcc" } +chrono_locale = { git = "https://github.com/0x5eal/chrono-locale.git", version = "v0.1.2" } ### CLI From 3b57d90a29b20ccc501f780cab68621b2f809c06 Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Wed, 23 Aug 2023 21:07:15 +0530 Subject: [PATCH 09/62] fix: tag instead of version --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 098094d8..fa3c1986 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -109,7 +109,7 @@ tokio-tungstenite = { version = "0.20", features = ["rustls-tls-webpki-roots"] } ### DATETIME chrono = "0.4.26" -chrono_locale = { git = "https://github.com/0x5eal/chrono-locale.git", version = "v0.1.2" } +chrono_locale = { git = "https://github.com/0x5eal/chrono-locale.git", tag = "v0.1.2" } ### CLI From 2a9984ff7403b51eca4ad5cd20df27c621aeefcc Mon Sep 17 00:00:00 2001 From: Compey Date: Thu, 24 Aug 2023 19:02:46 +0530 Subject: [PATCH 10/62] refactor: include docs & rename some methods --- Cargo.lock | 4 +- src/lune/builtins/date_time.rs | 116 ++++++++++++++++++++++++++------- 2 files changed, 95 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7d4e84f4..10c8d8ed 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -326,8 +326,8 @@ dependencies = [ [[package]] name = "chrono_locale" -version = "0.1.1" -source = "git+https://github.com/0x5eal/chrono-locale.git?rev=2a7ebcc#2a7ebcc019d133bc17833d66731092dee60dc3b7" +version = "0.1.2" +source = "git+https://github.com/0x5eal/chrono-locale.git?tag=v0.1.2#b47f2afe0661a6b15ae788af250ea8afa9e33a4d" dependencies = [ "chrono", "lazy_static", diff --git a/src/lune/builtins/date_time.rs b/src/lune/builtins/date_time.rs index 6c372881..3541664a 100644 --- a/src/lune/builtins/date_time.rs +++ b/src/lune/builtins/date_time.rs @@ -5,18 +5,27 @@ use once_cell::sync::Lazy; // TODO: Proper error handling and stuff +/// Possible types of timestamps accepted by `DateTime`. pub enum TimestampType { Seconds, Millis, } pub struct DateTime { + /// The number of **seconds** since January 1st, 1970 + /// at 00:00 UTC (the Unix epoch). Range is + /// -17,987,443,200 to 253,402,300,799, approximately + /// years 1400–9999. pub unix_timestamp: i64, + + /// The number of **milliseconds* since January 1st, 1970 + /// at 00:00 UTC (the Unix epoch). Range is -17,987,443,200,000 + /// to 253,402,300,799,999, approximately years 1400–9999. pub unix_timestamp_millis: i64, } impl DateTime { - /// Returns a DateTime representing the current moment in time + /// Returns a `DateTime` representing the current moment in time. pub fn now() -> Self { let time = Utc::now(); @@ -26,9 +35,9 @@ impl DateTime { } } - /// Returns a new DateTime object from the given unix timestamp, in either seconds on + /// Returns a new `DateTime` object from the given unix timestamp, in either seconds on /// milliseconds. In case of failure, defaults to the (seconds or - /// milliseconds) since January 1st, 1970 at 00:00 (UTC) + /// milliseconds) since January 1st, 1970 at 00:00 (UTC). pub fn from_unix_timestamp(timestamp_kind: TimestampType, unix_timestamp: i64) -> Self { let time_chrono = match timestamp_kind { TimestampType::Seconds => NaiveDateTime::from_timestamp_opt(unix_timestamp, 0), @@ -45,7 +54,15 @@ impl DateTime { } } - pub fn from_universal_time(date_time: Option) -> Self { + /// Returns a new `DateTime` using the given units from a UTC time. The + /// values accepted are similar to those found in the time value table + /// returned by `to_universal_time`. + /// + /// - Date units (year, month, day) that produce an invalid date will raise an error. For example, January 32nd or February 29th on a non-leap year. + /// - Time units (hour, minute, second, millisecond) that are outside their normal range are valid. For example, 90 minutes will cause the hour to roll over by 1; -10 seconds will cause the minute value to roll back by 1. + /// - Non-integer values are rounded down. For example, providing 2.5 hours will be equivalent to providing 2 hours, not 2 hours 30 minutes. + /// - Omitted values are assumed to be their lowest value in their normal range, except for year which defaults to 1970. + pub fn from_universal_time(date_time: Option) -> Self { if let Some(date_time) = date_time { let utc_time: ChronoDateTime = Utc.from_utc_datetime(&NaiveDateTime::new( NaiveDate::from_ymd_opt(date_time.year, date_time.month, date_time.day) @@ -73,7 +90,15 @@ impl DateTime { } } - pub fn from_local_time(date_time: Option) -> Self { + /// Returns a new `DateTime` using the given units from a UTC time. The + /// values accepted are similar to those found in the time value table + /// returned by `to_local_time`. + /// + /// - Date units (year, month, day) that produce an invalid date will raise an error. For example, January 32nd or February 29th on a non-leap year. + /// - Time units (hour, minute, second, millisecond) that are outside their normal range are valid. For example, 90 minutes will cause the hour to roll over by 1; -10 seconds will cause the minute value to roll back by 1. + /// - Non-integer values are rounded down. For example, providing 2.5 hours will be equivalent to providing 2 hours, not 2 hours 30 minutes. + /// - Omitted values are assumed to be their lowest value in their normal range, except for year which defaults to 1970. + pub fn from_local_time(date_time: Option) -> Self { if let Some(date_time) = date_time { let local_time: ChronoDateTime = Local .from_local_datetime(&NaiveDateTime::new( @@ -103,25 +128,36 @@ impl DateTime { } } - pub fn from_iso_date(iso_date: T) -> Self + /// Returns a `DateTime` from an ISO 8601 date-time string in UTC + /// time, such as those returned by `to_iso_date`. If the + /// string parsing fails, the function returns `None`. + /// + /// An example ISO 8601 date-time string would be `2020-01-02T10:30:45Z`, + /// which represents January 2nd 2020 at 10:30 AM, 45 seconds. + pub fn from_iso_date(iso_date: T) -> Option where T: ToString, { let time = ChronoDateTime::parse_from_str(iso_date.to_string().as_str(), "%Y-%m-%dT%H:%M:%SZ") - .expect("invalid ISO 8601 string"); + .ok()?; - Self { + Some(Self { unix_timestamp: time.timestamp(), unix_timestamp_millis: time.timestamp_millis(), - } + }) } - fn to_datetime_constructor(date_time: ChronoDateTime) -> DateTimeConstructor + /// Converts the value of this `DateTime` object to local time. The returned table + /// contains the following keys: `Year`, `Month`, `Day`, `Hour`, `Minute`, `Second`, + /// `Millisecond`. For more details, see the time value table in this data type's + /// description. The values within this table could be passed to `from_local_time` + /// to produce the original `DateTime` object. + pub fn to_datetime_builder(date_time: ChronoDateTime) -> DateTimeBuilder where T: TimeZone, { - let mut date_time_constructor = DateTimeConstructor::default(); + let mut date_time_constructor = DateTimeBuilder::default(); // Any less tedious way to get Enum member based on index? // I know there's some crates available with derive macros for this, @@ -151,25 +187,43 @@ impl DateTime { date_time_constructor } - pub fn to_local_time(&self) -> DateTimeConstructor { - Self::to_datetime_constructor(Local.timestamp_opt(self.unix_timestamp, 0).unwrap()) + /// Converts the value of this `DateTime` object to local time. The returned table + /// contains the following keys: `Year`, `Month`, `Day`, `Hour`, `Minute`, `Second`, + /// `Millisecond`. For more details, see the time value table in this data type's + /// description. The values within this table could be passed to `from_local_time` + /// to produce the original `DateTime` object. + pub fn to_local_time(&self) -> DateTimeBuilder { + Self::to_datetime_builder(Local.timestamp_opt(self.unix_timestamp, 0).unwrap()) } - pub fn to_universal_time(&self) -> DateTimeConstructor { - Self::to_datetime_constructor(Utc.timestamp_opt(self.unix_timestamp, 0).unwrap()) + /// Converts the value of this `DateTime` object to Universal Coordinated Time (UTC). + /// The returned table contains the following keys: `Year`, `Month`, `Day`, `Hour`, + /// `Minute`, `Second`, `Millisecond`. For more details, see the time value table + /// in this data type's description. The values within this table could be passed + /// to `from_universal_time` to produce the original `DateTime` object. + pub fn to_universal_time(&self) -> DateTimeBuilder { + Self::to_datetime_builder(Utc.timestamp_opt(self.unix_timestamp, 0).unwrap()) } + /// Formats a date as a ISO 8601 date-time string. The value returned by this + /// function could be passed to `from_local_time` to produce the original `DateTime` + /// object. pub fn to_iso_date(&self) -> String { self.to_universal_time() - .to_string::<&str>(Timezone::UTC, None, None) + .to_string::<&str>(Timezone::Utc, None, None) } // There seems to be only one localization crate for chrono, // which has been committed to last 5 years ago. Thus, this crate doesn't // work with the version of chrono we're using. I've forked the crate - // and have made it compatible with the latest version of chrono. + // and have made it compatible with the latest version of chrono. ~ DevComp // TODO: Implement more locales for chrono-locale. + + /// Generates a string from the `DateTime` value interpreted as **local time** + /// and a format string. The format string should contain tokens, which will + /// replace to certain date/time values described by the `DateTime` object. + /// For more details, see the [accepted formatter tokens](https://docs.rs/chrono/latest/chrono/format/strftime/index.html). pub fn format_time(&self, timezone: Timezone, fmt_str: T, locale: T) -> String where T: ToString, @@ -182,18 +236,25 @@ impl DateTime { } } -pub struct DateTimeConstructor { +pub struct DateTimeBuilder { + /// The year. In the range 1400 - 9999. pub year: i32, + /// The month. In the range 1 - 12. pub month: u32, + /// The day. In the range 1 - 31. pub day: u32, + /// The hour. In the range 0 - 23. pub hour: u32, + /// The minute. In the range 0 - 59. pub minute: u32, + /// The second. In the range usually 0 - 59, but sometimes 0 - 60 to accommodate leap seconds in certain systems. pub second: u32, + /// The milliseconds. In the range 0 - 999. pub millisecond: u32, } -impl Default for DateTimeConstructor { - /// Constructs the default state for DateTimeConstructor, which is the Unix Epoch. +impl Default for DateTimeBuilder { + /// Constructs the default state for DateTimeBuilder, which is the Unix Epoch. fn default() -> Self { Self { year: 1970, @@ -207,54 +268,63 @@ impl Default for DateTimeConstructor { } } +/// General timezone types accepted by `DateTime` methods. pub enum Timezone { - UTC, + Utc, Local, } -impl DateTimeConstructor { +impl DateTimeBuilder { + /// Builder method to set the `Year`. pub fn with_year(&mut self, year: i32) -> &mut Self { self.year = year; self } + /// Builder method to set the `Month`. pub fn with_month(&mut self, month: Month) -> &mut Self { self.month = month as u32; self } + /// Builder method to set the `Month`. pub fn with_day(&mut self, day: u32) -> &mut Self { self.day = day; self } + /// Builder method to set the `Hour`. pub fn with_hour(&mut self, hour: u32) -> &mut Self { self.hour = hour; self } + /// Builder method to set the `Minute`. pub fn with_minute(&mut self, minute: u32) -> &mut Self { self.minute = minute; self } + /// Builder method to set the `Second`. pub fn with_second(&mut self, second: u32) -> &mut Self { self.second = second; self } + /// Builder method to set the `Millisecond`. pub fn with_millisecond(&mut self, millisecond: u32) -> &mut Self { self.millisecond = millisecond; self } + /// Converts the `DateTimeBuilder` to a string with a specified format and locale. fn to_string(&self, timezone: Timezone, format: Option, locale: Option) -> String where T: ToString, @@ -276,7 +346,7 @@ impl DateTimeConstructor { }); match timezone { - Timezone::UTC => Utc + Timezone::Utc => Utc .with_ymd_and_hms( self.year, self.month, From 5bc28c499c8020268268d04f8168755bf385502d Mon Sep 17 00:00:00 2001 From: Compey Date: Thu, 24 Aug 2023 20:48:29 +0530 Subject: [PATCH 11/62] chore: remove conflicting files --- Cargo.lock | 2905 -------------------------------------- src/lune/builtins/mod.rs | 1 - 2 files changed, 2906 deletions(-) delete mode 100644 Cargo.lock diff --git a/Cargo.lock b/Cargo.lock deleted file mode 100644 index 10c8d8ed..00000000 --- a/Cargo.lock +++ /dev/null @@ -1,2905 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "addr2line" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "aho-corasick" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" -dependencies = [ - "memchr", -] - -[[package]] -name = "alloc-no-stdlib" -version = "2.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3" - -[[package]] -name = "alloc-stdlib" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece" -dependencies = [ - "alloc-no-stdlib", -] - -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - -[[package]] -name = "anstream" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" -dependencies = [ - "anstyle", - "anstyle-parse", - "anstyle-query", - "anstyle-wincon", - "colorchoice", - "is-terminal", - "utf8parse", -] - -[[package]] -name = "anstyle" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd" - -[[package]] -name = "anstyle-parse" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" -dependencies = [ - "utf8parse", -] - -[[package]] -name = "anstyle-query" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" -dependencies = [ - "windows-sys 0.48.0", -] - -[[package]] -name = "anstyle-wincon" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c677ab05e09154296dd37acecd46420c17b9713e8366facafa8fc0885167cf4c" -dependencies = [ - "anstyle", - "windows-sys 0.48.0", -] - -[[package]] -name = "anyhow" -version = "1.0.72" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b13c32d80ecc7ab747b80c3784bce54ee8a7a0cc4fbda9bf4cda2cf6fe90854" - -[[package]] -name = "arrayref" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" - -[[package]] -name = "arrayvec" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" - -[[package]] -name = "arrayvec" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" - -[[package]] -name = "async-compression" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b74f44609f0f91493e3082d3734d98497e094777144380ea4db9f9905dd5b6" -dependencies = [ - "brotli", - "flate2", - "futures-core", - "memchr", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "async-trait" -version = "0.1.72" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc6dde6e4ed435a4c1ee4e73592f5ba9da2151af10076cc04858746af9352d09" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.28", -] - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "backtrace" -version = "0.3.68" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" -dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - -[[package]] -name = "base-x" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270" - -[[package]] -name = "base64" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" - -[[package]] -name = "base64" -version = "0.21.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" - -[[package]] -name = "blake2b_simd" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afa748e348ad3be8263be728124b24a24f268266f6f5d58af9d75f6a40b5c587" -dependencies = [ - "arrayref", - "arrayvec 0.5.2", - "constant_time_eq 0.1.5", -] - -[[package]] -name = "blake3" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "199c42ab6972d92c9f8995f086273d25c42fc0f7b2a1fcefba465c1352d25ba5" -dependencies = [ - "arrayref", - "arrayvec 0.7.4", - "cc", - "cfg-if", - "constant_time_eq 0.3.0", - "digest", -] - -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array", -] - -[[package]] -name = "brotli" -version = "3.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1a0b1dbcc8ae29329621f8d4f0d835787c1c38bb1401979b49d13b0b305ff68" -dependencies = [ - "alloc-no-stdlib", - "alloc-stdlib", - "brotli-decompressor", -] - -[[package]] -name = "brotli-decompressor" -version = "2.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b6561fd3f895a11e8f72af2cb7d22e08366bebc2b6b57f7744c4bda27034744" -dependencies = [ - "alloc-no-stdlib", - "alloc-stdlib", -] - -[[package]] -name = "bstr" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6798148dccfbff0fae41c7574d2fa8f1ef3492fba0face179de5d8d447d67b05" -dependencies = [ - "memchr", - "serde", -] - -[[package]] -name = "bumpalo" -version = "3.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" - -[[package]] -name = "byteorder" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fc10e8cc6b2580fda3f36eb6dc5316657f812a3df879a44a66fc9f0fdbc4855" - -[[package]] -name = "byteorder" -version = "1.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" - -[[package]] -name = "bytes" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" - -[[package]] -name = "cc" -version = "1.0.82" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "305fe645edc1442a0fa8b6726ba61d422798d37a52e12eaecf4b022ebbb88f01" -dependencies = [ - "libc", -] - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "chrono" -version = "0.4.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" -dependencies = [ - "android-tzdata", - "iana-time-zone", - "js-sys", - "num-traits", - "time 0.1.45", - "wasm-bindgen", - "winapi", -] - -[[package]] -name = "chrono_locale" -version = "0.1.2" -source = "git+https://github.com/0x5eal/chrono-locale.git?tag=v0.1.2#b47f2afe0661a6b15ae788af250ea8afa9e33a4d" -dependencies = [ - "chrono", - "lazy_static", - "num-integer", - "serde", - "serde_derive", - "serde_json", - "walkdir", -] - -[[package]] -name = "clap" -version = "4.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c27cdf28c0f604ba3f512b0c9a409f8de8513e4816705deb0498b627e7c3a3fd" -dependencies = [ - "clap_builder", - "clap_derive", - "once_cell", -] - -[[package]] -name = "clap_builder" -version = "4.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08a9f1ab5e9f01a9b81f202e8562eb9a10de70abf9eaeac1be465c28b75aa4aa" -dependencies = [ - "anstream", - "anstyle", - "clap_lex", - "strsim", -] - -[[package]] -name = "clap_derive" -version = "4.3.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn 2.0.28", -] - -[[package]] -name = "clap_lex" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" - -[[package]] -name = "clipboard-win" -version = "4.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7191c27c2357d9b7ef96baac1773290d4ca63b24205b82a3fd8a0637afcf0362" -dependencies = [ - "error-code", - "str-buf", - "winapi", -] - -[[package]] -name = "colorchoice" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" - -[[package]] -name = "console" -version = "0.15.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c926e00cc70edefdc64d3a5ff31cc65bb97a3460097762bd23afb4d8145fccf8" -dependencies = [ - "encode_unicode", - "lazy_static", - "libc", - "unicode-width", - "windows-sys 0.45.0", -] - -[[package]] -name = "const_fn" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbdcdcb6d86f71c5e97409ad45898af11cbc995b4ee8112d59095a28d376c935" - -[[package]] -name = "constant_time_eq" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" - -[[package]] -name = "constant_time_eq" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" - -[[package]] -name = "cookie" -version = "0.15.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc6e25dfc584d06a3dbf775d207ff00d7de98d824c952dd2233dfbb261889a42" -dependencies = [ - "time 0.2.27", - "version_check", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" - -[[package]] -name = "cpufeatures" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" -dependencies = [ - "libc", -] - -[[package]] -name = "crc32fast" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "data-encoding" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" - -[[package]] -name = "deranged" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7684a49fb1af197853ef7b2ee694bc1f5b4179556f1e5710e1760c5db6f5e929" - -[[package]] -name = "dialoguer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59c6f2989294b9a498d3ad5491a79c6deb604617378e1cdc4bfc1c1361fe2f87" -dependencies = [ - "console", - "shell-words", - "tempfile", - "zeroize", -] - -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer", - "crypto-common", - "subtle", -] - -[[package]] -name = "directories" -version = "5.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a49173b84e034382284f27f1af4dcbbd231ffa358c0fe316541a7337f376a35" -dependencies = [ - "dirs-sys", -] - -[[package]] -name = "dirs" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fd78930633bd1c6e35c4b42b1df7b0cbc6bc191146e512bb3bedf243fcc3901" -dependencies = [ - "libc", - "redox_users 0.3.5", - "winapi", -] - -[[package]] -name = "dirs-sys" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" -dependencies = [ - "libc", - "option-ext", - "redox_users 0.4.3", - "windows-sys 0.48.0", -] - -[[package]] -name = "discard" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" - -[[package]] -name = "dunce" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" - -[[package]] -name = "either" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" - -[[package]] -name = "encode_unicode" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" - -[[package]] -name = "encoding_rs" -version = "0.8.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "endian-type" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" - -[[package]] -name = "env_logger" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" -dependencies = [ - "humantime", - "is-terminal", - "log", - "regex", - "termcolor", -] - -[[package]] -name = "equivalent" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" - -[[package]] -name = "erased-serde" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da96524cc884f6558f1769b6c46686af2fe8e8b4cd253bd5a3cdba8181b8e070" -dependencies = [ - "serde", -] - -[[package]] -name = "errno" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f" -dependencies = [ - "errno-dragonfly", - "libc", - "windows-sys 0.48.0", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] - -[[package]] -name = "error-code" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64f18991e7bf11e7ffee451b5318b5c1a73c52d0d0ada6e5a3017c8c1ced6a21" -dependencies = [ - "libc", - "str-buf", -] - -[[package]] -name = "fastrand" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" - -[[package]] -name = "fd-lock" -version = "3.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef033ed5e9bad94e55838ca0ca906db0e043f517adda0c8b79c7a8c66c93c1b5" -dependencies = [ - "cfg-if", - "rustix", - "windows-sys 0.48.0", -] - -[[package]] -name = "flate2" -version = "1.0.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" -dependencies = [ - "crc32fast", - "miniz_oxide", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "form_urlencoded" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" -dependencies = [ - "percent-encoding", -] - -[[package]] -name = "futures-channel" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" -dependencies = [ - "futures-core", -] - -[[package]] -name = "futures-core" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" - -[[package]] -name = "futures-macro" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.28", -] - -[[package]] -name = "futures-sink" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" - -[[package]] -name = "futures-task" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" - -[[package]] -name = "futures-util" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" -dependencies = [ - "futures-core", - "futures-macro", - "futures-sink", - "futures-task", - "pin-project-lite", - "pin-utils", - "slab", -] - -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] -name = "getrandom" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -dependencies = [ - "cfg-if", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", -] - -[[package]] -name = "getrandom" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" -dependencies = [ - "cfg-if", - "libc", - "wasi 0.11.0+wasi-snapshot-preview1", -] - -[[package]] -name = "gimli" -version = "0.27.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" - -[[package]] -name = "glam" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42218cb640844e3872cc3c153dc975229e080a6c4733b34709ef445610550226" - -[[package]] -name = "glob" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" - -[[package]] -name = "h2" -version = "0.3.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97ec8491ebaf99c8eaa73058b045fe58073cd6be7f596ac993ced0b0a0c01049" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http", - "indexmap 1.9.3", - "slab", - "tokio", - "tokio-util", - "tracing", -] - -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - -[[package]] -name = "hashbrown" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" - -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - -[[package]] -name = "hermit-abi" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" - -[[package]] -name = "home" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" -dependencies = [ - "windows-sys 0.48.0", -] - -[[package]] -name = "http" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "http-body" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" -dependencies = [ - "bytes", - "http", - "pin-project-lite", -] - -[[package]] -name = "httparse" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" - -[[package]] -name = "httpdate" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" - -[[package]] -name = "humantime" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" - -[[package]] -name = "hyper" -version = "0.14.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" -dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "socket2 0.4.9", - "tokio", - "tower-service", - "tracing", - "want", -] - -[[package]] -name = "hyper-rustls" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d78e1e73ec14cf7375674f74d7dde185c8206fd9dea6fb6295e8a98098aaa97" -dependencies = [ - "futures-util", - "http", - "hyper", - "rustls", - "tokio", - "tokio-rustls", -] - -[[package]] -name = "hyper-tungstenite" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cc7dcb1ab67cd336f468a12491765672e61a3b6b148634dbfe2fe8acd3fe7d9" -dependencies = [ - "hyper", - "pin-project-lite", - "tokio", - "tokio-tungstenite", - "tungstenite", -] - -[[package]] -name = "iana-time-zone" -version = "0.1.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "windows", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - -[[package]] -name = "idna" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - -[[package]] -name = "include_dir" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18762faeff7122e89e0857b02f7ce6fcc0d101d5e9ad2ad7846cc01d61b7f19e" -dependencies = [ - "glob", - "include_dir_macros", -] - -[[package]] -name = "include_dir_macros" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b139284b5cf57ecfa712bcc66950bb635b31aff41c188e8a4cfc758eca374a3f" -dependencies = [ - "proc-macro2", - "quote", -] - -[[package]] -name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", -] - -[[package]] -name = "indexmap" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" -dependencies = [ - "equivalent", - "hashbrown 0.14.0", -] - -[[package]] -name = "ipnet" -version = "2.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" - -[[package]] -name = "is-terminal" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" -dependencies = [ - "hermit-abi", - "rustix", - "windows-sys 0.48.0", -] - -[[package]] -name = "itertools" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" - -[[package]] -name = "js-sys" -version = "0.3.64" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "libc" -version = "0.2.147" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" - -[[package]] -name = "line-wrap" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30344350a2a51da54c1d53be93fade8a237e545dbcc4bdbe635413f2117cab9" -dependencies = [ - "safemem", -] - -[[package]] -name = "linux-raw-sys" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" - -[[package]] -name = "lock_api" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" - -[[package]] -name = "luau0-src" -version = "0.6.0+luau588" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c628f5525cc62a89a2d478b2ee619c77b35da55c8e3231752f3b8fe528a6c49" -dependencies = [ - "cc", -] - -[[package]] -name = "lune" -version = "0.7.6" -dependencies = [ - "anyhow", - "async-compression", - "async-trait", - "chrono", - "chrono_locale", - "clap", - "console", - "dialoguer", - "directories", - "dunce", - "env_logger", - "futures-util", - "glam", - "hyper", - "hyper-tungstenite", - "include_dir", - "itertools", - "lz4_flex", - "mlua", - "once_cell", - "os_str_bytes", - "pin-project", - "rand", - "rbx_binary", - "rbx_cookie", - "rbx_dom_weak", - "rbx_reflection", - "rbx_reflection_database", - "rbx_xml", - "regex", - "reqwest", - "rustyline", - "serde", - "serde_json", - "serde_yaml", - "thiserror", - "tokio", - "tokio-tungstenite", - "toml", - "urlencoding", -] - -[[package]] -name = "lz4" -version = "1.24.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e9e2dd86df36ce760a60f6ff6ad526f7ba1f14ba0356f8254fb6905e6494df1" -dependencies = [ - "libc", - "lz4-sys", -] - -[[package]] -name = "lz4-sys" -version = "1.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57d27b317e207b10f69f5e75494119e391a96f48861ae870d1da6edac98ca900" -dependencies = [ - "cc", - "libc", -] - -[[package]] -name = "lz4_flex" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ea9b256699eda7b0387ffbc776dd625e28bde3918446381781245b7a50349d8" -dependencies = [ - "twox-hash", -] - -[[package]] -name = "memchr" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" - -[[package]] -name = "mime" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" - -[[package]] -name = "miniz_oxide" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" -dependencies = [ - "adler", -] - -[[package]] -name = "mio" -version = "0.8.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" -dependencies = [ - "libc", - "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.48.0", -] - -[[package]] -name = "mlua" -version = "0.9.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01a6500a9fb74b519a85ac206cd57f9f91b270ce39d6cb12ab06a8ed29c3563d" -dependencies = [ - "bstr", - "erased-serde", - "mlua-sys", - "num-traits", - "once_cell", - "rustc-hash", - "serde", - "serde-value", -] - -[[package]] -name = "mlua-sys" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa5b61f6c943d77dd6ab5f670865670f65b978400127c8bf31c2df7d6e76289a" -dependencies = [ - "cc", - "cfg-if", - "luau0-src", - "pkg-config", -] - -[[package]] -name = "nibble_vec" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a5d83df9f36fe23f0c3648c6bbb8b0298bb5f1939c8f2704431371f4b84d43" -dependencies = [ - "smallvec", -] - -[[package]] -name = "nix" -version = "0.26.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a" -dependencies = [ - "bitflags 1.3.2", - "cfg-if", - "libc", - "static_assertions", -] - -[[package]] -name = "num-integer" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" -dependencies = [ - "autocfg", - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" -dependencies = [ - "autocfg", -] - -[[package]] -name = "num_cpus" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" -dependencies = [ - "hermit-abi", - "libc", -] - -[[package]] -name = "object" -version = "0.31.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" -dependencies = [ - "memchr", -] - -[[package]] -name = "once_cell" -version = "1.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" - -[[package]] -name = "option-ext" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" - -[[package]] -name = "ordered-float" -version = "2.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7940cf2ca942593318d07fcf2596cdca60a85c9e7fab408a5e21a4f9dcd40d87" -dependencies = [ - "num-traits", -] - -[[package]] -name = "os_str_bytes" -version = "6.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d5d9eb14b174ee9aa2ef96dc2b94637a2d4b6e7cb873c7e171f0c20c6cf3eac" -dependencies = [ - "memchr", -] - -[[package]] -name = "parking_lot" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall 0.3.5", - "smallvec", - "windows-targets 0.48.1", -] - -[[package]] -name = "paste" -version = "1.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" - -[[package]] -name = "percent-encoding" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" - -[[package]] -name = "pin-project" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.28", -] - -[[package]] -name = "pin-project-lite" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12cc1b0bf1727a77a54b6654e7b5f1af8604923edc8b81885f8ec92f9e3f0a05" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "pkg-config" -version = "0.3.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" - -[[package]] -name = "plist" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdc0001cfea3db57a2e24bc0d818e9e20e554b5f97fabb9bc231dc240269ae06" -dependencies = [ - "base64 0.21.2", - "indexmap 1.9.3", - "line-wrap", - "quick-xml", - "serde", - "time 0.3.25", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" - -[[package]] -name = "proc-macro-hack" -version = "0.5.20+deprecated" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" - -[[package]] -name = "proc-macro2" -version = "1.0.66" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "profiling" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46b2164ebdb1dfeec5e337be164292351e11daf63a05174c6776b2f47460f0c9" -dependencies = [ - "profiling-procmacros", -] - -[[package]] -name = "profiling-procmacros" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "097bf8b99121dfb8c75eed54dfbdbdb1d53e372c53d2353e8a15aad2a479249d" -dependencies = [ - "quote", - "syn 2.0.28", -] - -[[package]] -name = "quick-xml" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81b9228215d82c7b61490fec1de287136b5de6f5700f6e58ea9ad61a7964ca51" -dependencies = [ - "memchr", -] - -[[package]] -name = "quote" -version = "1.0.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "radix_trie" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c069c179fcdc6a2fe24d8d18305cf085fdbd4f922c041943e203685d6a1c58fd" -dependencies = [ - "endian-type", - "nibble_vec", -] - -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha", - "rand_core", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom 0.2.10", -] - -[[package]] -name = "rbx_binary" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e50573021d04b680018955662eba7dc4aac3de92219231798f6c9b41e38ab01" -dependencies = [ - "log", - "lz4", - "profiling", - "rbx_dom_weak", - "rbx_reflection", - "rbx_reflection_database", - "thiserror", -] - -[[package]] -name = "rbx_cookie" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6716fd418196130f1dd19947608b94bda942d096b514be9b441409d262bf5e59" -dependencies = [ - "byteorder 0.5.3", - "cookie", - "dirs", - "log", - "plist", - "winapi", - "winreg", -] - -[[package]] -name = "rbx_dom_weak" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "161729449bbb0cfa657ce7bcca6a160d0af06d8b8d9efdc9abe14735dccacdb9" -dependencies = [ - "rbx_types", - "serde", -] - -[[package]] -name = "rbx_reflection" -version = "4.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08bd48487192046fec8f805f3fa29f3d7d5beb9890b0859b1a92bd8aff580343" -dependencies = [ - "rbx_types", - "serde", - "thiserror", -] - -[[package]] -name = "rbx_reflection_database" -version = "0.2.7+roblox-588" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1be6cf674182806f11ad4899dd1feafe977591f1ae035ae05a58d4b74e487276" -dependencies = [ - "lazy_static", - "rbx_reflection", - "rmp-serde", - "serde", -] - -[[package]] -name = "rbx_types" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "070106e926b8ae54c7bc443e5db4d868d7f0af51c1d7cfd7efe1364c1753d8a3" -dependencies = [ - "base64 0.13.1", - "bitflags 1.3.2", - "blake3", - "lazy_static", - "rand", - "serde", - "thiserror", -] - -[[package]] -name = "rbx_xml" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bc65b70827519fdc4ab47416d1085b912f087fadab9ed415471b6daba635574" -dependencies = [ - "base64 0.13.1", - "log", - "rbx_dom_weak", - "rbx_reflection", - "rbx_reflection_database", - "xml-rs", -] - -[[package]] -name = "redox_syscall" -version = "0.1.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" - -[[package]] -name = "redox_syscall" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags 1.3.2", -] - -[[package]] -name = "redox_syscall" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" -dependencies = [ - "bitflags 1.3.2", -] - -[[package]] -name = "redox_users" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de0737333e7a9502c789a36d7c7fa6092a49895d4faa31ca5df163857ded2e9d" -dependencies = [ - "getrandom 0.1.16", - "redox_syscall 0.1.57", - "rust-argon2", -] - -[[package]] -name = "redox_users" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" -dependencies = [ - "getrandom 0.2.10", - "redox_syscall 0.2.16", - "thiserror", -] - -[[package]] -name = "regex" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" - -[[package]] -name = "reqwest" -version = "0.11.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55" -dependencies = [ - "base64 0.21.2", - "bytes", - "encoding_rs", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "hyper", - "hyper-rustls", - "ipnet", - "js-sys", - "log", - "mime", - "once_cell", - "percent-encoding", - "pin-project-lite", - "rustls", - "rustls-pemfile", - "serde", - "serde_json", - "serde_urlencoded", - "tokio", - "tokio-rustls", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "webpki-roots 0.22.6", - "winreg", -] - -[[package]] -name = "ring" -version = "0.16.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" -dependencies = [ - "cc", - "libc", - "once_cell", - "spin", - "untrusted", - "web-sys", - "winapi", -] - -[[package]] -name = "rmp" -version = "0.8.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f9860a6cc38ed1da53456442089b4dfa35e7cedaa326df63017af88385e6b20" -dependencies = [ - "byteorder 1.4.3", - "num-traits", - "paste", -] - -[[package]] -name = "rmp-serde" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bffea85eea980d8a74453e5d02a8d93028f3c34725de143085a844ebe953258a" -dependencies = [ - "byteorder 1.4.3", - "rmp", - "serde", -] - -[[package]] -name = "rust-argon2" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b18820d944b33caa75a71378964ac46f58517c92b6ae5f762636247c09e78fb" -dependencies = [ - "base64 0.13.1", - "blake2b_simd", - "constant_time_eq 0.1.5", - "crossbeam-utils", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" - -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - -[[package]] -name = "rustc_version" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -dependencies = [ - "semver", -] - -[[package]] -name = "rustix" -version = "0.38.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "172891ebdceb05aa0005f533a6cbfca599ddd7d966f6f5d4d9b2e70478e70399" -dependencies = [ - "bitflags 2.3.3", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.48.0", -] - -[[package]] -name = "rustls" -version = "0.21.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d1feddffcfcc0b33f5c6ce9a29e341e4cd59c3f78e7ee45f4a40c038b1d6cbb" -dependencies = [ - "log", - "ring", - "rustls-webpki 0.101.3", - "sct", -] - -[[package]] -name = "rustls-pemfile" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" -dependencies = [ - "base64 0.21.2", -] - -[[package]] -name = "rustls-webpki" -version = "0.100.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6207cd5ed3d8dca7816f8f3725513a34609c0c765bf652b8c3cb4cfd87db46b" -dependencies = [ - "ring", - "untrusted", -] - -[[package]] -name = "rustls-webpki" -version = "0.101.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "261e9e0888cba427c3316e6322805653c9425240b6fd96cee7cb671ab70ab8d0" -dependencies = [ - "ring", - "untrusted", -] - -[[package]] -name = "rustyline" -version = "12.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "994eca4bca05c87e86e15d90fc7a91d1be64b4482b38cb2d27474568fe7c9db9" -dependencies = [ - "bitflags 2.3.3", - "cfg-if", - "clipboard-win", - "fd-lock", - "home", - "libc", - "log", - "memchr", - "nix", - "radix_trie", - "scopeguard", - "unicode-segmentation", - "unicode-width", - "utf8parse", - "winapi", -] - -[[package]] -name = "ryu" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" - -[[package]] -name = "safemem" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" - -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - -[[package]] -name = "sct" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" -dependencies = [ - "ring", - "untrusted", -] - -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -dependencies = [ - "semver-parser", -] - -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" - -[[package]] -name = "serde" -version = "1.0.183" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32ac8da02677876d532745a130fc9d8e6edfa81a269b107c5b00829b91d8eb3c" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde-value" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3a1a3341211875ef120e117ea7fd5228530ae7e7036a779fdc9117be6b3282c" -dependencies = [ - "ordered-float", - "serde", -] - -[[package]] -name = "serde_derive" -version = "1.0.183" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aafe972d60b0b9bee71a91b92fee2d4fb3c9d7e8f6b179aa99f27203d99a4816" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.28", -] - -[[package]] -name = "serde_json" -version = "1.0.104" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "076066c5f1078eac5b722a31827a8832fe108bed65dfa75e233c89f8206e976c" -dependencies = [ - "indexmap 2.0.0", - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "serde_spanned" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186" -dependencies = [ - "serde", -] - -[[package]] -name = "serde_urlencoded" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" -dependencies = [ - "form_urlencoded", - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "serde_yaml" -version = "0.9.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a49e178e4452f45cb61d0cd8cebc1b0fafd3e41929e996cef79aa3aca91f574" -dependencies = [ - "indexmap 2.0.0", - "itoa", - "ryu", - "serde", - "unsafe-libyaml", -] - -[[package]] -name = "sha1" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1da05c97445caa12d05e848c4a4fcbbea29e748ac28f7e80e9b010392063770" -dependencies = [ - "sha1_smol", -] - -[[package]] -name = "sha1" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - -[[package]] -name = "sha1_smol" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae1a47186c03a32177042e55dbc5fd5aee900b8e0069a8d70fba96a9375cd012" - -[[package]] -name = "shell-words" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" - -[[package]] -name = "signal-hook-registry" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" -dependencies = [ - "libc", -] - -[[package]] -name = "slab" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" -dependencies = [ - "autocfg", -] - -[[package]] -name = "smallvec" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" - -[[package]] -name = "socket2" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "socket2" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877" -dependencies = [ - "libc", - "windows-sys 0.48.0", -] - -[[package]] -name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" - -[[package]] -name = "standback" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e113fb6f3de07a243d434a56ec6f186dfd51cb08448239fe7bcae73f87ff28ff" -dependencies = [ - "version_check", -] - -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] -name = "stdweb" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5" -dependencies = [ - "discard", - "rustc_version", - "stdweb-derive", - "stdweb-internal-macros", - "stdweb-internal-runtime", - "wasm-bindgen", -] - -[[package]] -name = "stdweb-derive" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" -dependencies = [ - "proc-macro2", - "quote", - "serde", - "serde_derive", - "syn 1.0.109", -] - -[[package]] -name = "stdweb-internal-macros" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11" -dependencies = [ - "base-x", - "proc-macro2", - "quote", - "serde", - "serde_derive", - "serde_json", - "sha1 0.6.1", - "syn 1.0.109", -] - -[[package]] -name = "stdweb-internal-runtime" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" - -[[package]] -name = "str-buf" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e08d8363704e6c71fc928674353e6b7c23dcea9d82d7012c8faf2a3a025f8d0" - -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - -[[package]] -name = "subtle" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "tempfile" -version = "3.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc02fddf48964c42031a0b3fe0428320ecf3a73c401040fc0096f97794310651" -dependencies = [ - "cfg-if", - "fastrand", - "redox_syscall 0.3.5", - "rustix", - "windows-sys 0.48.0", -] - -[[package]] -name = "termcolor" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "thiserror" -version = "1.0.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.28", -] - -[[package]] -name = "time" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" -dependencies = [ - "libc", - "wasi 0.10.0+wasi-snapshot-preview1", - "winapi", -] - -[[package]] -name = "time" -version = "0.2.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4752a97f8eebd6854ff91f1c1824cd6160626ac4bd44287f7f4ea2035a02a242" -dependencies = [ - "const_fn", - "libc", - "standback", - "stdweb", - "time-macros 0.1.1", - "version_check", - "winapi", -] - -[[package]] -name = "time" -version = "0.3.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fdd63d58b18d663fbdf70e049f00a22c8e42be082203be7f26589213cd75ea" -dependencies = [ - "deranged", - "itoa", - "serde", - "time-core", - "time-macros 0.2.11", -] - -[[package]] -name = "time-core" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" - -[[package]] -name = "time-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "957e9c6e26f12cb6d0dd7fc776bb67a706312e7299aed74c8dd5b17ebb27e2f1" -dependencies = [ - "proc-macro-hack", - "time-macros-impl", -] - -[[package]] -name = "time-macros" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb71511c991639bb078fd5bf97757e03914361c48100d52878b8e52b46fb92cd" -dependencies = [ - "time-core", -] - -[[package]] -name = "time-macros-impl" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd3c141a1b43194f3f56a1411225df8646c55781d5f26db825b3d98507eb482f" -dependencies = [ - "proc-macro-hack", - "proc-macro2", - "quote", - "standback", - "syn 1.0.109", -] - -[[package]] -name = "tinyvec" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - -[[package]] -name = "tokio" -version = "1.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d3ce25f50619af8b0aec2eb23deebe84249e19e2ddd393a6e16e3300a6dadfd" -dependencies = [ - "backtrace", - "bytes", - "libc", - "mio", - "num_cpus", - "parking_lot", - "pin-project-lite", - "signal-hook-registry", - "socket2 0.5.3", - "tokio-macros", - "windows-sys 0.48.0", -] - -[[package]] -name = "tokio-macros" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.28", -] - -[[package]] -name = "tokio-rustls" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" -dependencies = [ - "rustls", - "tokio", -] - -[[package]] -name = "tokio-tungstenite" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b2dbec703c26b00d74844519606ef15d09a7d6857860f84ad223dec002ddea2" -dependencies = [ - "futures-util", - "log", - "rustls", - "tokio", - "tokio-rustls", - "tungstenite", - "webpki-roots 0.23.1", -] - -[[package]] -name = "tokio-util" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "pin-project-lite", - "tokio", - "tracing", -] - -[[package]] -name = "toml" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c17e963a819c331dcacd7ab957d80bc2b9a9c1e71c804826d2f283dd65306542" -dependencies = [ - "indexmap 2.0.0", - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit", -] - -[[package]] -name = "toml_datetime" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" -dependencies = [ - "serde", -] - -[[package]] -name = "toml_edit" -version = "0.19.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" -dependencies = [ - "indexmap 2.0.0", - "serde", - "serde_spanned", - "toml_datetime", - "winnow", -] - -[[package]] -name = "tower-service" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" - -[[package]] -name = "tracing" -version = "0.1.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" -dependencies = [ - "cfg-if", - "pin-project-lite", - "tracing-core", -] - -[[package]] -name = "tracing-core" -version = "0.1.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" -dependencies = [ - "once_cell", -] - -[[package]] -name = "try-lock" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" - -[[package]] -name = "tungstenite" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e862a1c4128df0112ab625f55cd5c934bcb4312ba80b39ae4b4835a3fd58e649" -dependencies = [ - "byteorder 1.4.3", - "bytes", - "data-encoding", - "http", - "httparse", - "log", - "rand", - "rustls", - "sha1 0.10.5", - "thiserror", - "url", - "utf-8", -] - -[[package]] -name = "twox-hash" -version = "1.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" -dependencies = [ - "cfg-if", - "static_assertions", -] - -[[package]] -name = "typenum" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" - -[[package]] -name = "unicode-bidi" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" - -[[package]] -name = "unicode-ident" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" - -[[package]] -name = "unicode-normalization" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "unicode-segmentation" -version = "1.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" - -[[package]] -name = "unicode-width" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" - -[[package]] -name = "unsafe-libyaml" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f28467d3e1d3c6586d8f25fa243f544f5800fec42d97032474e17222c2b75cfa" - -[[package]] -name = "untrusted" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" - -[[package]] -name = "url" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", -] - -[[package]] -name = "urlencoding" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" - -[[package]] -name = "utf-8" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" - -[[package]] -name = "utf8parse" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" - -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "walkdir" -version = "2.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" -dependencies = [ - "same-file", - "winapi-util", -] - -[[package]] -name = "want" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" -dependencies = [ - "try-lock", -] - -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - -[[package]] -name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "wasm-bindgen" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn 2.0.28", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" -dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.28", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" - -[[package]] -name = "web-sys" -version = "0.3.64" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "webpki" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" -dependencies = [ - "ring", - "untrusted", -] - -[[package]] -name = "webpki-roots" -version = "0.22.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" -dependencies = [ - "webpki", -] - -[[package]] -name = "webpki-roots" -version = "0.23.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b03058f88386e5ff5310d9111d53f48b17d732b401aeb83a8d5190f2ac459338" -dependencies = [ - "rustls-webpki 0.100.1", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" -dependencies = [ - "windows-targets 0.48.1", -] - -[[package]] -name = "windows-sys" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" -dependencies = [ - "windows-targets 0.42.2", -] - -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets 0.48.1", -] - -[[package]] -name = "windows-targets" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", -] - -[[package]] -name = "windows-targets" -version = "0.48.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" -dependencies = [ - "windows_aarch64_gnullvm 0.48.0", - "windows_aarch64_msvc 0.48.0", - "windows_i686_gnu 0.48.0", - "windows_i686_msvc 0.48.0", - "windows_x86_64_gnu 0.48.0", - "windows_x86_64_gnullvm 0.48.0", - "windows_x86_64_msvc 0.48.0", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" - -[[package]] -name = "windows_i686_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" - -[[package]] -name = "windows_i686_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" - -[[package]] -name = "winnow" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acaaa1190073b2b101e15083c38ee8ec891b5e05cbee516521e94ec008f61e64" -dependencies = [ - "memchr", -] - -[[package]] -name = "winreg" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" -dependencies = [ - "winapi", -] - -[[package]] -name = "xml-rs" -version = "0.8.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47430998a7b5d499ccee752b41567bc3afc57e1327dc855b1a2aa44ce29b5fa1" - -[[package]] -name = "zeroize" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" diff --git a/src/lune/builtins/mod.rs b/src/lune/builtins/mod.rs index 312305df..46aefbe5 100644 --- a/src/lune/builtins/mod.rs +++ b/src/lune/builtins/mod.rs @@ -6,7 +6,6 @@ pub mod serde; pub mod stdio; pub mod task; pub mod top_level; -pub mod date_time; #[cfg(feature = "roblox")] pub mod roblox; From 8f41ef1aaae6e9d2355ba4681b4dc9cc0c117820 Mon Sep 17 00:00:00 2001 From: Compey Date: Thu, 24 Aug 2023 21:07:07 +0530 Subject: [PATCH 12/62] chore: regenerate cargo lockfile --- Cargo.lock | 2902 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 2902 insertions(+) create mode 100644 Cargo.lock diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 00000000..fa8a8c8c --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,2902 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "addr2line" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "aho-corasick" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6748e8def348ed4d14996fa801f4122cd763fff530258cdc03f64b25f89d3a5a" +dependencies = [ + "memchr", +] + +[[package]] +name = "alloc-no-stdlib" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3" + +[[package]] +name = "alloc-stdlib" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece" +dependencies = [ + "alloc-no-stdlib", +] + +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "anstream" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is-terminal", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15c4c2c83f81532e5845a733998b6971faca23490340a418e9b72a3ec9de12ea" + +[[package]] +name = "anstyle-parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +dependencies = [ + "windows-sys 0.48.0", +] + +[[package]] +name = "anstyle-wincon" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c677ab05e09154296dd37acecd46420c17b9713e8366facafa8fc0885167cf4c" +dependencies = [ + "anstyle", + "windows-sys 0.48.0", +] + +[[package]] +name = "anyhow" +version = "1.0.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" + +[[package]] +name = "arrayref" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" + +[[package]] +name = "arrayvec" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" + +[[package]] +name = "arrayvec" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" + +[[package]] +name = "async-compression" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b74f44609f0f91493e3082d3734d98497e094777144380ea4db9f9905dd5b6" +dependencies = [ + "brotli", + "flate2", + "futures-core", + "memchr", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "async-trait" +version = "0.1.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "backtrace" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "base-x" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270" + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "base64" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" + +[[package]] +name = "blake2b_simd" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afa748e348ad3be8263be728124b24a24f268266f6f5d58af9d75f6a40b5c587" +dependencies = [ + "arrayref", + "arrayvec 0.5.2", + "constant_time_eq 0.1.5", +] + +[[package]] +name = "blake3" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "199c42ab6972d92c9f8995f086273d25c42fc0f7b2a1fcefba465c1352d25ba5" +dependencies = [ + "arrayref", + "arrayvec 0.7.4", + "cc", + "cfg-if", + "constant_time_eq 0.3.0", + "digest", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "brotli" +version = "3.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1a0b1dbcc8ae29329621f8d4f0d835787c1c38bb1401979b49d13b0b305ff68" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", + "brotli-decompressor", +] + +[[package]] +name = "brotli-decompressor" +version = "2.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b6561fd3f895a11e8f72af2cb7d22e08366bebc2b6b57f7744c4bda27034744" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", +] + +[[package]] +name = "bstr" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6798148dccfbff0fae41c7574d2fa8f1ef3492fba0face179de5d8d447d67b05" +dependencies = [ + "memchr", + "serde", +] + +[[package]] +name = "bumpalo" +version = "3.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" + +[[package]] +name = "byteorder" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fc10e8cc6b2580fda3f36eb6dc5316657f812a3df879a44a66fc9f0fdbc4855" + +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + +[[package]] +name = "bytes" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" + +[[package]] +name = "cc" +version = "1.0.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "libc", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chrono" +version = "0.4.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "js-sys", + "num-traits", + "time 0.1.45", + "wasm-bindgen", + "winapi", +] + +[[package]] +name = "chrono_locale" +version = "0.1.2" +source = "git+https://github.com/0x5eal/chrono-locale.git?tag=v0.1.2#b47f2afe0661a6b15ae788af250ea8afa9e33a4d" +dependencies = [ + "chrono", + "lazy_static", + "num-integer", + "serde", + "serde_derive", + "serde_json", + "walkdir", +] + +[[package]] +name = "clap" +version = "4.3.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb690e81c7840c0d7aade59f242ea3b41b9bc27bcd5997890e7702ae4b32e487" +dependencies = [ + "clap_builder", + "clap_derive", + "once_cell", +] + +[[package]] +name = "clap_builder" +version = "4.3.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ed2e96bc16d8d740f6f48d663eddf4b8a0983e79210fd55479b7bcd0a69860e" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.29", +] + +[[package]] +name = "clap_lex" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" + +[[package]] +name = "clipboard-win" +version = "4.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7191c27c2357d9b7ef96baac1773290d4ca63b24205b82a3fd8a0637afcf0362" +dependencies = [ + "error-code", + "str-buf", + "winapi", +] + +[[package]] +name = "colorchoice" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" + +[[package]] +name = "console" +version = "0.15.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c926e00cc70edefdc64d3a5ff31cc65bb97a3460097762bd23afb4d8145fccf8" +dependencies = [ + "encode_unicode", + "lazy_static", + "libc", + "unicode-width", + "windows-sys 0.45.0", +] + +[[package]] +name = "const_fn" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbdcdcb6d86f71c5e97409ad45898af11cbc995b4ee8112d59095a28d376c935" + +[[package]] +name = "constant_time_eq" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" + +[[package]] +name = "constant_time_eq" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" + +[[package]] +name = "cookie" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc6e25dfc584d06a3dbf775d207ff00d7de98d824c952dd2233dfbb261889a42" +dependencies = [ + "time 0.2.27", + "version_check", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" + +[[package]] +name = "cpufeatures" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "data-encoding" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" + +[[package]] +name = "deranged" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2696e8a945f658fd14dc3b87242e6b80cd0f36ff04ea560fa39082368847946" + +[[package]] +name = "dialoguer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59c6f2989294b9a498d3ad5491a79c6deb604617378e1cdc4bfc1c1361fe2f87" +dependencies = [ + "console", + "shell-words", + "tempfile", + "zeroize", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", + "subtle", +] + +[[package]] +name = "directories" +version = "5.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a49173b84e034382284f27f1af4dcbbd231ffa358c0fe316541a7337f376a35" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fd78930633bd1c6e35c4b42b1df7b0cbc6bc191146e512bb3bedf243fcc3901" +dependencies = [ + "libc", + "redox_users 0.3.5", + "winapi", +] + +[[package]] +name = "dirs-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" +dependencies = [ + "libc", + "option-ext", + "redox_users 0.4.3", + "windows-sys 0.48.0", +] + +[[package]] +name = "discard" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" + +[[package]] +name = "dunce" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" + +[[package]] +name = "either" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" + +[[package]] +name = "encode_unicode" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" + +[[package]] +name = "encoding_rs" +version = "0.8.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "endian-type" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" + +[[package]] +name = "env_logger" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" +dependencies = [ + "humantime", + "is-terminal", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "erased-serde" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "837c0466252947ada828b975e12daf82e18bb5444e4df87be6038d4469e2a3d2" +dependencies = [ + "serde", +] + +[[package]] +name = "errno" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f" +dependencies = [ + "errno-dragonfly", + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "error-code" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64f18991e7bf11e7ffee451b5318b5c1a73c52d0d0ada6e5a3017c8c1ced6a21" +dependencies = [ + "libc", + "str-buf", +] + +[[package]] +name = "fastrand" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" + +[[package]] +name = "fd-lock" +version = "3.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef033ed5e9bad94e55838ca0ca906db0e043f517adda0c8b79c7a8c66c93c1b5" +dependencies = [ + "cfg-if", + "rustix", + "windows-sys 0.48.0", +] + +[[package]] +name = "flate2" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "form_urlencoded" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures-channel" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" + +[[package]] +name = "futures-macro" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", +] + +[[package]] +name = "futures-sink" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" + +[[package]] +name = "futures-task" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" + +[[package]] +name = "futures-util" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +dependencies = [ + "futures-core", + "futures-macro", + "futures-sink", + "futures-task", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", +] + +[[package]] +name = "gimli" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" + +[[package]] +name = "glam" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42218cb640844e3872cc3c153dc975229e080a6c4733b34709ef445610550226" + +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + +[[package]] +name = "h2" +version = "0.3.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap 1.9.3", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "hermit-abi" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" + +[[package]] +name = "home" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" +dependencies = [ + "windows-sys 0.48.0", +] + +[[package]] +name = "http" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + +[[package]] +name = "hyper" +version = "0.14.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2 0.4.9", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d78e1e73ec14cf7375674f74d7dde185c8206fd9dea6fb6295e8a98098aaa97" +dependencies = [ + "futures-util", + "http", + "hyper", + "rustls", + "tokio", + "tokio-rustls", +] + +[[package]] +name = "hyper-tungstenite" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cc7dcb1ab67cd336f468a12491765672e61a3b6b148634dbfe2fe8acd3fe7d9" +dependencies = [ + "hyper", + "pin-project-lite", + "tokio", + "tokio-tungstenite", + "tungstenite", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "idna" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "include_dir" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18762faeff7122e89e0857b02f7ce6fcc0d101d5e9ad2ad7846cc01d61b7f19e" +dependencies = [ + "glob", + "include_dir_macros", +] + +[[package]] +name = "include_dir_macros" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b139284b5cf57ecfa712bcc66950bb635b31aff41c188e8a4cfc758eca374a3f" +dependencies = [ + "proc-macro2", + "quote", +] + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", +] + +[[package]] +name = "indexmap" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +dependencies = [ + "equivalent", + "hashbrown 0.14.0", +] + +[[package]] +name = "ipnet" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" + +[[package]] +name = "is-terminal" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +dependencies = [ + "hermit-abi", + "rustix", + "windows-sys 0.48.0", +] + +[[package]] +name = "itertools" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" + +[[package]] +name = "js-sys" +version = "0.3.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.147" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" + +[[package]] +name = "line-wrap" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f30344350a2a51da54c1d53be93fade8a237e545dbcc4bdbe635413f2117cab9" +dependencies = [ + "safemem", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" + +[[package]] +name = "lock_api" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" + +[[package]] +name = "luau0-src" +version = "0.7.1+luau591" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fb600eccdbc0bb69e746fddb756559a67b5fcfc01c8a142c6853fec76b6bfc7" +dependencies = [ + "cc", +] + +[[package]] +name = "lune" +version = "0.7.6" +dependencies = [ + "anyhow", + "async-compression", + "async-trait", + "chrono", + "chrono_locale", + "clap", + "console", + "dialoguer", + "directories", + "dunce", + "env_logger", + "futures-util", + "glam", + "hyper", + "hyper-tungstenite", + "include_dir", + "itertools", + "lz4_flex", + "mlua", + "once_cell", + "os_str_bytes", + "pin-project", + "rand", + "rbx_binary", + "rbx_cookie", + "rbx_dom_weak", + "rbx_reflection", + "rbx_reflection_database", + "rbx_xml", + "regex", + "reqwest", + "rustyline", + "serde", + "serde_json", + "serde_yaml", + "thiserror", + "tokio", + "tokio-tungstenite", + "toml", + "urlencoding", +] + +[[package]] +name = "lz4" +version = "1.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e9e2dd86df36ce760a60f6ff6ad526f7ba1f14ba0356f8254fb6905e6494df1" +dependencies = [ + "libc", + "lz4-sys", +] + +[[package]] +name = "lz4-sys" +version = "1.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57d27b317e207b10f69f5e75494119e391a96f48861ae870d1da6edac98ca900" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "lz4_flex" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ea9b256699eda7b0387ffbc776dd625e28bde3918446381781245b7a50349d8" +dependencies = [ + "twox-hash", +] + +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "miniz_oxide" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +dependencies = [ + "adler", +] + +[[package]] +name = "mio" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +dependencies = [ + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", + "windows-sys 0.48.0", +] + +[[package]] +name = "mlua" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c3a7a7ff4481ec91b951a733390211a8ace1caba57266ccb5f4d4966704e560" +dependencies = [ + "bstr", + "erased-serde", + "mlua-sys", + "num-traits", + "once_cell", + "rustc-hash", + "serde", + "serde-value", +] + +[[package]] +name = "mlua-sys" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ec8b54eddb76093069cce9eeffb4c7b3a1a0fe66962d7bd44c4867928149ca3" +dependencies = [ + "cc", + "cfg-if", + "luau0-src", + "pkg-config", +] + +[[package]] +name = "nibble_vec" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a5d83df9f36fe23f0c3648c6bbb8b0298bb5f1939c8f2704431371f4b84d43" +dependencies = [ + "smallvec", +] + +[[package]] +name = "nix" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a" +dependencies = [ + "bitflags 1.3.2", + "cfg-if", + "libc", + "static_assertions", +] + +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "object" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ac5bbd07aea88c60a577a1ce218075ffd59208b2d7ca97adf9bfc5aeb21ebe" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" + +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + +[[package]] +name = "ordered-float" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7940cf2ca942593318d07fcf2596cdca60a85c9e7fab408a5e21a4f9dcd40d87" +dependencies = [ + "num-traits", +] + +[[package]] +name = "os_str_bytes" +version = "6.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d5d9eb14b174ee9aa2ef96dc2b94637a2d4b6e7cb873c7e171f0c20c6cf3eac" +dependencies = [ + "memchr", +] + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall 0.3.5", + "smallvec", + "windows-targets 0.48.5", +] + +[[package]] +name = "paste" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" + +[[package]] +name = "percent-encoding" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" + +[[package]] +name = "pin-project" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12cc1b0bf1727a77a54b6654e7b5f1af8604923edc8b81885f8ec92f9e3f0a05" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkg-config" +version = "0.3.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" + +[[package]] +name = "plist" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdc0001cfea3db57a2e24bc0d818e9e20e554b5f97fabb9bc231dc240269ae06" +dependencies = [ + "base64 0.21.2", + "indexmap 1.9.3", + "line-wrap", + "quick-xml", + "serde", + "time 0.3.27", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "proc-macro-hack" +version = "0.5.20+deprecated" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" + +[[package]] +name = "proc-macro2" +version = "1.0.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "profiling" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46b2164ebdb1dfeec5e337be164292351e11daf63a05174c6776b2f47460f0c9" +dependencies = [ + "profiling-procmacros", +] + +[[package]] +name = "profiling-procmacros" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "097bf8b99121dfb8c75eed54dfbdbdb1d53e372c53d2353e8a15aad2a479249d" +dependencies = [ + "quote", + "syn 2.0.29", +] + +[[package]] +name = "quick-xml" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81b9228215d82c7b61490fec1de287136b5de6f5700f6e58ea9ad61a7964ca51" +dependencies = [ + "memchr", +] + +[[package]] +name = "quote" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radix_trie" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c069c179fcdc6a2fe24d8d18305cf085fdbd4f922c041943e203685d6a1c58fd" +dependencies = [ + "endian-type", + "nibble_vec", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.10", +] + +[[package]] +name = "rbx_binary" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e50573021d04b680018955662eba7dc4aac3de92219231798f6c9b41e38ab01" +dependencies = [ + "log", + "lz4", + "profiling", + "rbx_dom_weak", + "rbx_reflection", + "rbx_reflection_database", + "thiserror", +] + +[[package]] +name = "rbx_cookie" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6716fd418196130f1dd19947608b94bda942d096b514be9b441409d262bf5e59" +dependencies = [ + "byteorder 0.5.3", + "cookie", + "dirs", + "log", + "plist", + "winapi", + "winreg 0.10.1", +] + +[[package]] +name = "rbx_dom_weak" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "161729449bbb0cfa657ce7bcca6a160d0af06d8b8d9efdc9abe14735dccacdb9" +dependencies = [ + "rbx_types", + "serde", +] + +[[package]] +name = "rbx_reflection" +version = "4.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08bd48487192046fec8f805f3fa29f3d7d5beb9890b0859b1a92bd8aff580343" +dependencies = [ + "rbx_types", + "serde", + "thiserror", +] + +[[package]] +name = "rbx_reflection_database" +version = "0.2.7+roblox-588" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1be6cf674182806f11ad4899dd1feafe977591f1ae035ae05a58d4b74e487276" +dependencies = [ + "lazy_static", + "rbx_reflection", + "rmp-serde", + "serde", +] + +[[package]] +name = "rbx_types" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "070106e926b8ae54c7bc443e5db4d868d7f0af51c1d7cfd7efe1364c1753d8a3" +dependencies = [ + "base64 0.13.1", + "bitflags 1.3.2", + "blake3", + "lazy_static", + "rand", + "serde", + "thiserror", +] + +[[package]] +name = "rbx_xml" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bc65b70827519fdc4ab47416d1085b912f087fadab9ed415471b6daba635574" +dependencies = [ + "base64 0.13.1", + "log", + "rbx_dom_weak", + "rbx_reflection", + "rbx_reflection_database", + "xml-rs", +] + +[[package]] +name = "redox_syscall" +version = "0.1.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" + +[[package]] +name = "redox_syscall" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "redox_syscall" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "redox_users" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de0737333e7a9502c789a36d7c7fa6092a49895d4faa31ca5df163857ded2e9d" +dependencies = [ + "getrandom 0.1.16", + "redox_syscall 0.1.57", + "rust-argon2", +] + +[[package]] +name = "redox_users" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" +dependencies = [ + "getrandom 0.2.10", + "redox_syscall 0.2.16", + "thiserror", +] + +[[package]] +name = "regex" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" + +[[package]] +name = "reqwest" +version = "0.11.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e9ad3fe7488d7e34558a2033d45a0c90b72d97b4f80705666fea71472e2e6a1" +dependencies = [ + "base64 0.21.2", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-rustls", + "ipnet", + "js-sys", + "log", + "mime", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls", + "rustls-pemfile", + "serde", + "serde_json", + "serde_urlencoded", + "tokio", + "tokio-rustls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots 0.25.2", + "winreg 0.50.0", +] + +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin", + "untrusted", + "web-sys", + "winapi", +] + +[[package]] +name = "rmp" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9860a6cc38ed1da53456442089b4dfa35e7cedaa326df63017af88385e6b20" +dependencies = [ + "byteorder 1.4.3", + "num-traits", + "paste", +] + +[[package]] +name = "rmp-serde" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bffea85eea980d8a74453e5d02a8d93028f3c34725de143085a844ebe953258a" +dependencies = [ + "byteorder 1.4.3", + "rmp", + "serde", +] + +[[package]] +name = "rust-argon2" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b18820d944b33caa75a71378964ac46f58517c92b6ae5f762636247c09e78fb" +dependencies = [ + "base64 0.13.1", + "blake2b_simd", + "constant_time_eq 0.1.5", + "crossbeam-utils", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "0.38.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ed4fa021d81c8392ce04db050a3da9a60299050b7ae1cf482d862b54a7218f" +dependencies = [ + "bitflags 2.4.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.48.0", +] + +[[package]] +name = "rustls" +version = "0.21.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1feddffcfcc0b33f5c6ce9a29e341e4cd59c3f78e7ee45f4a40c038b1d6cbb" +dependencies = [ + "log", + "ring", + "rustls-webpki 0.101.4", + "sct", +] + +[[package]] +name = "rustls-pemfile" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" +dependencies = [ + "base64 0.21.2", +] + +[[package]] +name = "rustls-webpki" +version = "0.100.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e98ff011474fa39949b7e5c0428f9b4937eda7da7848bbb947786b7be0b27dab" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "rustls-webpki" +version = "0.101.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d93931baf2d282fff8d3a532bbfd7653f734643161b87e3e01e59a04439bf0d" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "rustyline" +version = "12.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "994eca4bca05c87e86e15d90fc7a91d1be64b4482b38cb2d27474568fe7c9db9" +dependencies = [ + "bitflags 2.4.0", + "cfg-if", + "clipboard-win", + "fd-lock", + "home", + "libc", + "log", + "memchr", + "nix", + "radix_trie", + "scopeguard", + "unicode-segmentation", + "unicode-width", + "utf8parse", + "winapi", +] + +[[package]] +name = "ryu" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" + +[[package]] +name = "safemem" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "sct" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + +[[package]] +name = "serde" +version = "1.0.186" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f5db24220c009de9bd45e69fb2938f4b6d2df856aa9304ce377b3180f83b7c1" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde-value" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3a1a3341211875ef120e117ea7fd5228530ae7e7036a779fdc9117be6b3282c" +dependencies = [ + "ordered-float", + "serde", +] + +[[package]] +name = "serde_derive" +version = "1.0.186" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ad697f7e0b65af4983a4ce8f56ed5b357e8d3c36651bf6a7e13639c17b8e670" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", +] + +[[package]] +name = "serde_json" +version = "1.0.105" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360" +dependencies = [ + "indexmap 2.0.0", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_spanned" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_yaml" +version = "0.9.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a49e178e4452f45cb61d0cd8cebc1b0fafd3e41929e996cef79aa3aca91f574" +dependencies = [ + "indexmap 2.0.0", + "itoa", + "ryu", + "serde", + "unsafe-libyaml", +] + +[[package]] +name = "sha1" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1da05c97445caa12d05e848c4a4fcbbea29e748ac28f7e80e9b010392063770" +dependencies = [ + "sha1_smol", +] + +[[package]] +name = "sha1" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha1_smol" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae1a47186c03a32177042e55dbc5fd5aee900b8e0069a8d70fba96a9375cd012" + +[[package]] +name = "shell-words" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" + +[[package]] +name = "signal-hook-registry" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +dependencies = [ + "libc", +] + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "smallvec" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" + +[[package]] +name = "socket2" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "socket2" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877" +dependencies = [ + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "standback" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e113fb6f3de07a243d434a56ec6f186dfd51cb08448239fe7bcae73f87ff28ff" +dependencies = [ + "version_check", +] + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "stdweb" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5" +dependencies = [ + "discard", + "rustc_version", + "stdweb-derive", + "stdweb-internal-macros", + "stdweb-internal-runtime", + "wasm-bindgen", +] + +[[package]] +name = "stdweb-derive" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" +dependencies = [ + "proc-macro2", + "quote", + "serde", + "serde_derive", + "syn 1.0.109", +] + +[[package]] +name = "stdweb-internal-macros" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11" +dependencies = [ + "base-x", + "proc-macro2", + "quote", + "serde", + "serde_derive", + "serde_json", + "sha1 0.6.1", + "syn 1.0.109", +] + +[[package]] +name = "stdweb-internal-runtime" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" + +[[package]] +name = "str-buf" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e08d8363704e6c71fc928674353e6b7c23dcea9d82d7012c8faf2a3a025f8d0" + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "subtle" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tempfile" +version = "3.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" +dependencies = [ + "cfg-if", + "fastrand", + "redox_syscall 0.3.5", + "rustix", + "windows-sys 0.48.0", +] + +[[package]] +name = "termcolor" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "thiserror" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97a802ec30afc17eee47b2855fc72e0c4cd62be9b4efe6591edde0ec5bd68d8f" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", +] + +[[package]] +name = "time" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" +dependencies = [ + "libc", + "wasi 0.10.0+wasi-snapshot-preview1", + "winapi", +] + +[[package]] +name = "time" +version = "0.2.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4752a97f8eebd6854ff91f1c1824cd6160626ac4bd44287f7f4ea2035a02a242" +dependencies = [ + "const_fn", + "libc", + "standback", + "stdweb", + "time-macros 0.1.1", + "version_check", + "winapi", +] + +[[package]] +name = "time" +version = "0.3.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bb39ee79a6d8de55f48f2293a830e040392f1c5f16e336bdd1788cd0aadce07" +dependencies = [ + "deranged", + "itoa", + "serde", + "time-core", + "time-macros 0.2.13", +] + +[[package]] +name = "time-core" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" + +[[package]] +name = "time-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "957e9c6e26f12cb6d0dd7fc776bb67a706312e7299aed74c8dd5b17ebb27e2f1" +dependencies = [ + "proc-macro-hack", + "time-macros-impl", +] + +[[package]] +name = "time-macros" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "733d258752e9303d392b94b75230d07b0b9c489350c69b851fc6c065fde3e8f9" +dependencies = [ + "time-core", +] + +[[package]] +name = "time-macros-impl" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd3c141a1b43194f3f56a1411225df8646c55781d5f26db825b3d98507eb482f" +dependencies = [ + "proc-macro-hack", + "proc-macro2", + "quote", + "standback", + "syn 1.0.109", +] + +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "num_cpus", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2 0.5.3", + "tokio-macros", + "windows-sys 0.48.0", +] + +[[package]] +name = "tokio-macros" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", +] + +[[package]] +name = "tokio-rustls" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tokio-tungstenite" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b2dbec703c26b00d74844519606ef15d09a7d6857860f84ad223dec002ddea2" +dependencies = [ + "futures-util", + "log", + "rustls", + "tokio", + "tokio-rustls", + "tungstenite", + "webpki-roots 0.23.1", +] + +[[package]] +name = "tokio-util" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", +] + +[[package]] +name = "toml" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c17e963a819c331dcacd7ab957d80bc2b9a9c1e71c804826d2f283dd65306542" +dependencies = [ + "indexmap 2.0.0", + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.19.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" +dependencies = [ + "indexmap 2.0.0", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] +name = "tracing" +version = "0.1.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +dependencies = [ + "cfg-if", + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" + +[[package]] +name = "tungstenite" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e862a1c4128df0112ab625f55cd5c934bcb4312ba80b39ae4b4835a3fd58e649" +dependencies = [ + "byteorder 1.4.3", + "bytes", + "data-encoding", + "http", + "httparse", + "log", + "rand", + "rustls", + "sha1 0.10.5", + "thiserror", + "url", + "utf-8", +] + +[[package]] +name = "twox-hash" +version = "1.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" +dependencies = [ + "cfg-if", + "static_assertions", +] + +[[package]] +name = "typenum" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" + +[[package]] +name = "unicode-bidi" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" + +[[package]] +name = "unicode-ident" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" + +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-segmentation" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" + +[[package]] +name = "unicode-width" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" + +[[package]] +name = "unsafe-libyaml" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28467d3e1d3c6586d8f25fa243f544f5800fec42d97032474e17222c2b75cfa" + +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + +[[package]] +name = "url" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "urlencoding" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" + +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + +[[package]] +name = "utf8parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "walkdir" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + +[[package]] +name = "wasi" +version = "0.10.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.29", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" + +[[package]] +name = "web-sys" +version = "0.3.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-roots" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b03058f88386e5ff5310d9111d53f48b17d732b401aeb83a8d5190f2ac459338" +dependencies = [ + "rustls-webpki 0.100.2", +] + +[[package]] +name = "webpki-roots" +version = "0.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "winnow" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c2e3184b9c4e92ad5167ca73039d0c42476302ab603e2fec4487511f38ccefc" +dependencies = [ + "memchr", +] + +[[package]] +name = "winreg" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" +dependencies = [ + "winapi", +] + +[[package]] +name = "winreg" +version = "0.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + +[[package]] +name = "xml-rs" +version = "0.8.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47430998a7b5d499ccee752b41567bc3afc57e1327dc855b1a2aa44ce29b5fa1" + +[[package]] +name = "zeroize" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" From 5fed1a6c83f85b466fbc35ab9a62a020a5331f1f Mon Sep 17 00:00:00 2001 From: Compey Date: Thu, 24 Aug 2023 21:16:06 +0530 Subject: [PATCH 13/62] chore: resolve merge conflicts --- Cargo.lock | 277 +++++++++++++++++++++++++++-------------------------- 1 file changed, 140 insertions(+), 137 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fa8a8c8c..10c8d8ed 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "addr2line" -version = "0.21.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" dependencies = [ "gimli", ] @@ -19,9 +19,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "aho-corasick" -version = "1.0.4" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6748e8def348ed4d14996fa801f4122cd763fff530258cdc03f64b25f89d3a5a" +checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" dependencies = [ "memchr", ] @@ -73,9 +73,9 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.2" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15c4c2c83f81532e5845a733998b6971faca23490340a418e9b72a3ec9de12ea" +checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd" [[package]] name = "anstyle-parse" @@ -107,9 +107,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.75" +version = "1.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +checksum = "3b13c32d80ecc7ab747b80c3784bce54ee8a7a0cc4fbda9bf4cda2cf6fe90854" [[package]] name = "arrayref" @@ -145,13 +145,13 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.73" +version = "0.1.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" +checksum = "cc6dde6e4ed435a4c1ee4e73592f5ba9da2151af10076cc04858746af9352d09" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.28", ] [[package]] @@ -162,9 +162,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.69" +version = "0.3.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" dependencies = [ "addr2line", "cc", @@ -201,9 +201,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.0" +version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" +checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" [[package]] name = "blake2b_simd" @@ -296,9 +296,9 @@ checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" [[package]] name = "cc" -version = "1.0.83" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +checksum = "305fe645edc1442a0fa8b6726ba61d422798d37a52e12eaecf4b022ebbb88f01" dependencies = [ "libc", ] @@ -340,9 +340,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.24" +version = "4.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb690e81c7840c0d7aade59f242ea3b41b9bc27bcd5997890e7702ae4b32e487" +checksum = "c27cdf28c0f604ba3f512b0c9a409f8de8513e4816705deb0498b627e7c3a3fd" dependencies = [ "clap_builder", "clap_derive", @@ -351,9 +351,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.3.24" +version = "4.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ed2e96bc16d8d740f6f48d663eddf4b8a0983e79210fd55479b7bcd0a69860e" +checksum = "08a9f1ab5e9f01a9b81f202e8562eb9a10de70abf9eaeac1be465c28b75aa4aa" dependencies = [ "anstream", "anstyle", @@ -370,7 +370,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.28", ] [[package]] @@ -488,9 +488,9 @@ checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" [[package]] name = "deranged" -version = "0.3.8" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2696e8a945f658fd14dc3b87242e6b80cd0f36ff04ea560fa39082368847946" +checksum = "7684a49fb1af197853ef7b2ee694bc1f5b4179556f1e5710e1760c5db6f5e929" [[package]] name = "dialoguer" @@ -573,9 +573,9 @@ checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" [[package]] name = "encoding_rs" -version = "0.8.33" +version = "0.8.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" +checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" dependencies = [ "cfg-if", ] @@ -607,9 +607,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "erased-serde" -version = "0.3.30" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "837c0466252947ada828b975e12daf82e18bb5444e4df87be6038d4469e2a3d2" +checksum = "da96524cc884f6558f1769b6c46686af2fe8e8b4cd253bd5a3cdba8181b8e070" dependencies = [ "serde", ] @@ -664,9 +664,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.27" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" +checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" dependencies = [ "crc32fast", "miniz_oxide", @@ -710,7 +710,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.28", ] [[package]] @@ -774,9 +774,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.28.0" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" +checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" [[package]] name = "glam" @@ -792,9 +792,9 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "h2" -version = "0.3.21" +version = "0.3.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" +checksum = "97ec8491ebaf99c8eaa73058b045fe58073cd6be7f596ac993ced0b0a0c01049" dependencies = [ "bytes", "fnv", @@ -872,9 +872,9 @@ checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" [[package]] name = "httpdate" -version = "1.0.3" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" [[package]] name = "humantime" @@ -1086,15 +1086,15 @@ dependencies = [ [[package]] name = "log" -version = "0.4.20" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" [[package]] name = "luau0-src" -version = "0.7.1+luau591" +version = "0.6.0+luau588" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fb600eccdbc0bb69e746fddb756559a67b5fcfc01c8a142c6853fec76b6bfc7" +checksum = "4c628f5525cc62a89a2d478b2ee619c77b35da55c8e3231752f3b8fe528a6c49" dependencies = [ "cc", ] @@ -1208,9 +1208,9 @@ dependencies = [ [[package]] name = "mlua" -version = "0.9.1" +version = "0.9.0-rc.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c3a7a7ff4481ec91b951a733390211a8ace1caba57266ccb5f4d4966704e560" +checksum = "01a6500a9fb74b519a85ac206cd57f9f91b270ce39d6cb12ab06a8ed29c3563d" dependencies = [ "bstr", "erased-serde", @@ -1224,9 +1224,9 @@ dependencies = [ [[package]] name = "mlua-sys" -version = "0.3.2" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ec8b54eddb76093069cce9eeffb4c7b3a1a0fe66962d7bd44c4867928149ca3" +checksum = "aa5b61f6c943d77dd6ab5f670865670f65b978400127c8bf31c2df7d6e76289a" dependencies = [ "cc", "cfg-if", @@ -1286,9 +1286,9 @@ dependencies = [ [[package]] name = "object" -version = "0.32.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ac5bbd07aea88c60a577a1ce218075ffd59208b2d7ca97adf9bfc5aeb21ebe" +checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" dependencies = [ "memchr", ] @@ -1343,7 +1343,7 @@ dependencies = [ "libc", "redox_syscall 0.3.5", "smallvec", - "windows-targets 0.48.5", + "windows-targets 0.48.1", ] [[package]] @@ -1375,7 +1375,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.28", ] [[package]] @@ -1407,7 +1407,7 @@ dependencies = [ "line-wrap", "quick-xml", "serde", - "time 0.3.27", + "time 0.3.25", ] [[package]] @@ -1447,7 +1447,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "097bf8b99121dfb8c75eed54dfbdbdb1d53e372c53d2353e8a15aad2a479249d" dependencies = [ "quote", - "syn 2.0.29", + "syn 2.0.28", ] [[package]] @@ -1461,9 +1461,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.33" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" dependencies = [ "proc-macro2", ] @@ -1535,7 +1535,7 @@ dependencies = [ "log", "plist", "winapi", - "winreg 0.10.1", + "winreg", ] [[package]] @@ -1677,9 +1677,9 @@ checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" [[package]] name = "reqwest" -version = "0.11.20" +version = "0.11.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e9ad3fe7488d7e34558a2033d45a0c90b72d97b4f80705666fea71472e2e6a1" +checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55" dependencies = [ "base64 0.21.2", "bytes", @@ -1710,8 +1710,8 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "webpki-roots 0.25.2", - "winreg 0.50.0", + "webpki-roots 0.22.6", + "winreg", ] [[package]] @@ -1786,11 +1786,11 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.8" +version = "0.38.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19ed4fa021d81c8392ce04db050a3da9a60299050b7ae1cf482d862b54a7218f" +checksum = "172891ebdceb05aa0005f533a6cbfca599ddd7d966f6f5d4d9b2e70478e70399" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.3.3", "errno", "libc", "linux-raw-sys", @@ -1805,7 +1805,7 @@ checksum = "1d1feddffcfcc0b33f5c6ce9a29e341e4cd59c3f78e7ee45f4a40c038b1d6cbb" dependencies = [ "log", "ring", - "rustls-webpki 0.101.4", + "rustls-webpki 0.101.3", "sct", ] @@ -1820,9 +1820,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.100.2" +version = "0.100.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e98ff011474fa39949b7e5c0428f9b4937eda7da7848bbb947786b7be0b27dab" +checksum = "d6207cd5ed3d8dca7816f8f3725513a34609c0c765bf652b8c3cb4cfd87db46b" dependencies = [ "ring", "untrusted", @@ -1830,9 +1830,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.101.4" +version = "0.101.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d93931baf2d282fff8d3a532bbfd7653f734643161b87e3e01e59a04439bf0d" +checksum = "261e9e0888cba427c3316e6322805653c9425240b6fd96cee7cb671ab70ab8d0" dependencies = [ "ring", "untrusted", @@ -1844,7 +1844,7 @@ version = "12.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "994eca4bca05c87e86e15d90fc7a91d1be64b4482b38cb2d27474568fe7c9db9" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.3.3", "cfg-if", "clipboard-win", "fd-lock", @@ -1915,9 +1915,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.186" +version = "1.0.183" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f5db24220c009de9bd45e69fb2938f4b6d2df856aa9304ce377b3180f83b7c1" +checksum = "32ac8da02677876d532745a130fc9d8e6edfa81a269b107c5b00829b91d8eb3c" dependencies = [ "serde_derive", ] @@ -1934,20 +1934,20 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.186" +version = "1.0.183" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ad697f7e0b65af4983a4ce8f56ed5b357e8d3c36651bf6a7e13639c17b8e670" +checksum = "aafe972d60b0b9bee71a91b92fee2d4fb3c9d7e8f6b179aa99f27203d99a4816" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.28", ] [[package]] name = "serde_json" -version = "1.0.105" +version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360" +checksum = "076066c5f1078eac5b722a31827a8832fe108bed65dfa75e233c89f8206e976c" dependencies = [ "indexmap 2.0.0", "itoa", @@ -2032,9 +2032,9 @@ dependencies = [ [[package]] name = "slab" -version = "0.4.9" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" dependencies = [ "autocfg", ] @@ -2166,9 +2166,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.29" +version = "2.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a" +checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567" dependencies = [ "proc-macro2", "quote", @@ -2177,9 +2177,9 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.8.0" +version = "3.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" +checksum = "dc02fddf48964c42031a0b3fe0428320ecf3a73c401040fc0096f97794310651" dependencies = [ "cfg-if", "fastrand", @@ -2199,22 +2199,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.47" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97a802ec30afc17eee47b2855fc72e0c4cd62be9b4efe6591edde0ec5bd68d8f" +checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.47" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b" +checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.28", ] [[package]] @@ -2245,15 +2245,15 @@ dependencies = [ [[package]] name = "time" -version = "0.3.27" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bb39ee79a6d8de55f48f2293a830e040392f1c5f16e336bdd1788cd0aadce07" +checksum = "b0fdd63d58b18d663fbdf70e049f00a22c8e42be082203be7f26589213cd75ea" dependencies = [ "deranged", "itoa", "serde", "time-core", - "time-macros 0.2.13", + "time-macros 0.2.11", ] [[package]] @@ -2274,9 +2274,9 @@ dependencies = [ [[package]] name = "time-macros" -version = "0.2.13" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "733d258752e9303d392b94b75230d07b0b9c489350c69b851fc6c065fde3e8f9" +checksum = "eb71511c991639bb078fd5bf97757e03914361c48100d52878b8e52b46fb92cd" dependencies = [ "time-core", ] @@ -2311,9 +2311,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.32.0" +version = "1.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9" +checksum = "2d3ce25f50619af8b0aec2eb23deebe84249e19e2ddd393a6e16e3300a6dadfd" dependencies = [ "backtrace", "bytes", @@ -2336,7 +2336,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.28", ] [[package]] @@ -2619,7 +2619,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.28", "wasm-bindgen-shared", ] @@ -2653,7 +2653,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.28", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2674,20 +2674,33 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "webpki" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "webpki-roots" -version = "0.23.1" +version = "0.22.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b03058f88386e5ff5310d9111d53f48b17d732b401aeb83a8d5190f2ac459338" +checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" dependencies = [ - "rustls-webpki 0.100.2", + "webpki", ] [[package]] name = "webpki-roots" -version = "0.25.2" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" +checksum = "b03058f88386e5ff5310d9111d53f48b17d732b401aeb83a8d5190f2ac459338" +dependencies = [ + "rustls-webpki 0.100.1", +] [[package]] name = "winapi" @@ -2726,7 +2739,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ - "windows-targets 0.48.5", + "windows-targets 0.48.1", ] [[package]] @@ -2744,7 +2757,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets 0.48.5", + "windows-targets 0.48.1", ] [[package]] @@ -2764,17 +2777,17 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.5" +version = "0.48.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", + "windows_aarch64_gnullvm 0.48.0", + "windows_aarch64_msvc 0.48.0", + "windows_i686_gnu 0.48.0", + "windows_i686_msvc 0.48.0", + "windows_x86_64_gnu 0.48.0", + "windows_x86_64_gnullvm 0.48.0", + "windows_x86_64_msvc 0.48.0", ] [[package]] @@ -2785,9 +2798,9 @@ checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.5" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" +checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" [[package]] name = "windows_aarch64_msvc" @@ -2797,9 +2810,9 @@ checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" [[package]] name = "windows_aarch64_msvc" -version = "0.48.5" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" +checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" [[package]] name = "windows_i686_gnu" @@ -2809,9 +2822,9 @@ checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" [[package]] name = "windows_i686_gnu" -version = "0.48.5" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" [[package]] name = "windows_i686_msvc" @@ -2821,9 +2834,9 @@ checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" [[package]] name = "windows_i686_msvc" -version = "0.48.5" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" +checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" [[package]] name = "windows_x86_64_gnu" @@ -2833,9 +2846,9 @@ checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" [[package]] name = "windows_x86_64_gnu" -version = "0.48.5" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" +checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" [[package]] name = "windows_x86_64_gnullvm" @@ -2845,9 +2858,9 @@ checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.5" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" [[package]] name = "windows_x86_64_msvc" @@ -2857,15 +2870,15 @@ checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" [[package]] name = "windows_x86_64_msvc" -version = "0.48.5" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" +checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "winnow" -version = "0.5.15" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c2e3184b9c4e92ad5167ca73039d0c42476302ab603e2fec4487511f38ccefc" +checksum = "acaaa1190073b2b101e15083c38ee8ec891b5e05cbee516521e94ec008f61e64" dependencies = [ "memchr", ] @@ -2879,16 +2892,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "winreg" -version = "0.50.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" -dependencies = [ - "cfg-if", - "windows-sys 0.48.0", -] - [[package]] name = "xml-rs" version = "0.8.16" From c260c45bfae0ac0a879d4631890e9f77a7853195 Mon Sep 17 00:00:00 2001 From: Compey Date: Thu, 24 Aug 2023 21:18:10 +0530 Subject: [PATCH 14/62] chore: resolve merge conflicts --- Cargo.lock | 125 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 121 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fa8a8c8c..a3744caf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1101,7 +1101,7 @@ dependencies = [ [[package]] name = "lune" -version = "0.7.6" +version = "0.7.7" dependencies = [ "anyhow", "async-compression", @@ -1124,6 +1124,7 @@ dependencies = [ "mlua", "once_cell", "os_str_bytes", + "path-clean", "pin-project", "rand", "rbx_binary", @@ -1142,6 +1143,8 @@ dependencies = [ "tokio", "tokio-tungstenite", "toml", + "tracing", + "tracing-subscriber", "urlencoding", ] @@ -1174,6 +1177,15 @@ dependencies = [ "twox-hash", ] +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] + [[package]] name = "memchr" version = "2.5.0" @@ -1255,6 +1267,16 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + [[package]] name = "num-integer" version = "0.1.45" @@ -1323,6 +1345,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + [[package]] name = "parking_lot" version = "0.12.1" @@ -1352,6 +1380,12 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" +[[package]] +name = "path-clean" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17359afc20d7ab31fdb42bb844c8b3bb1dabd7dcf7e68428492da7f16966fcef" + [[package]] name = "percent-encoding" version = "2.3.0" @@ -1654,8 +1688,17 @@ checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a" dependencies = [ "aho-corasick", "memchr", - "regex-automata", - "regex-syntax", + "regex-automata 0.3.6", + "regex-syntax 0.7.4", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax 0.6.29", ] [[package]] @@ -1666,9 +1709,15 @@ checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69" dependencies = [ "aho-corasick", "memchr", - "regex-syntax", + "regex-syntax 0.7.4", ] +[[package]] +name = "regex-syntax" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + [[package]] name = "regex-syntax" version = "0.7.4" @@ -2015,6 +2064,15 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae1a47186c03a32177042e55dbc5fd5aee900b8e0069a8d70fba96a9375cd012" +[[package]] +name = "sharded-slab" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" +dependencies = [ + "lazy_static", +] + [[package]] name = "shell-words" version = "1.1.0" @@ -2217,6 +2275,16 @@ dependencies = [ "syn 2.0.29", ] +[[package]] +name = "thread_local" +version = "1.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +dependencies = [ + "cfg-if", + "once_cell", +] + [[package]] name = "time" version = "0.1.45" @@ -2325,6 +2393,7 @@ dependencies = [ "signal-hook-registry", "socket2 0.5.3", "tokio-macros", + "tracing", "windows-sys 0.48.0", ] @@ -2427,9 +2496,21 @@ checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ "cfg-if", "pin-project-lite", + "tracing-attributes", "tracing-core", ] +[[package]] +name = "tracing-attributes" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", +] + [[package]] name = "tracing-core" version = "0.1.31" @@ -2437,6 +2518,36 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" dependencies = [ "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" +dependencies = [ + "lazy_static", + "log", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", ] [[package]] @@ -2555,6 +2666,12 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + [[package]] name = "version_check" version = "0.9.4" From 9443ae13fd3ad1968b9fe2f6aa94faac7c540215 Mon Sep 17 00:00:00 2001 From: Compey Date: Thu, 24 Aug 2023 21:22:47 +0530 Subject: [PATCH 15/62] chore: regenerate lockfile --- Cargo.lock | 125 ++--------------------------------------------------- 1 file changed, 4 insertions(+), 121 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c4b5b61d..10c8d8ed 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1101,7 +1101,7 @@ dependencies = [ [[package]] name = "lune" -version = "0.7.7" +version = "0.7.6" dependencies = [ "anyhow", "async-compression", @@ -1124,7 +1124,6 @@ dependencies = [ "mlua", "once_cell", "os_str_bytes", - "path-clean", "pin-project", "rand", "rbx_binary", @@ -1143,8 +1142,6 @@ dependencies = [ "tokio", "tokio-tungstenite", "toml", - "tracing", - "tracing-subscriber", "urlencoding", ] @@ -1177,15 +1174,6 @@ dependencies = [ "twox-hash", ] -[[package]] -name = "matchers" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" -dependencies = [ - "regex-automata 0.1.10", -] - [[package]] name = "memchr" version = "2.5.0" @@ -1267,16 +1255,6 @@ dependencies = [ "static_assertions", ] -[[package]] -name = "nu-ansi-term" -version = "0.46.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" -dependencies = [ - "overload", - "winapi", -] - [[package]] name = "num-integer" version = "0.1.45" @@ -1345,12 +1323,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "overload" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" - [[package]] name = "parking_lot" version = "0.12.1" @@ -1380,12 +1352,6 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" -[[package]] -name = "path-clean" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17359afc20d7ab31fdb42bb844c8b3bb1dabd7dcf7e68428492da7f16966fcef" - [[package]] name = "percent-encoding" version = "2.3.0" @@ -1688,17 +1654,8 @@ checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.3.6", - "regex-syntax 0.7.4", -] - -[[package]] -name = "regex-automata" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" -dependencies = [ - "regex-syntax 0.6.29", + "regex-automata", + "regex-syntax", ] [[package]] @@ -1709,15 +1666,9 @@ checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.7.4", + "regex-syntax", ] -[[package]] -name = "regex-syntax" -version = "0.6.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - [[package]] name = "regex-syntax" version = "0.7.4" @@ -2064,15 +2015,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae1a47186c03a32177042e55dbc5fd5aee900b8e0069a8d70fba96a9375cd012" -[[package]] -name = "sharded-slab" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" -dependencies = [ - "lazy_static", -] - [[package]] name = "shell-words" version = "1.1.0" @@ -2275,16 +2217,6 @@ dependencies = [ "syn 2.0.28", ] -[[package]] -name = "thread_local" -version = "1.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" -dependencies = [ - "cfg-if", - "once_cell", -] - [[package]] name = "time" version = "0.1.45" @@ -2393,7 +2325,6 @@ dependencies = [ "signal-hook-registry", "socket2 0.5.3", "tokio-macros", - "tracing", "windows-sys 0.48.0", ] @@ -2496,21 +2427,9 @@ checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ "cfg-if", "pin-project-lite", - "tracing-attributes", "tracing-core", ] -[[package]] -name = "tracing-attributes" -version = "0.1.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.29", -] - [[package]] name = "tracing-core" version = "0.1.31" @@ -2518,36 +2437,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" dependencies = [ "once_cell", - "valuable", -] - -[[package]] -name = "tracing-log" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" -dependencies = [ - "lazy_static", - "log", - "tracing-core", -] - -[[package]] -name = "tracing-subscriber" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77" -dependencies = [ - "matchers", - "nu-ansi-term", - "once_cell", - "regex", - "sharded-slab", - "smallvec", - "thread_local", - "tracing", - "tracing-core", - "tracing-log", ] [[package]] @@ -2666,12 +2555,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" -[[package]] -name = "valuable" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" - [[package]] name = "version_check" version = "0.9.4" From ac45d82de28788032dacf0e0501d38c84d7e7398 Mon Sep 17 00:00:00 2001 From: Compey Date: Thu, 24 Aug 2023 21:24:40 +0530 Subject: [PATCH 16/62] fix: export date_time in mod.rs --- src/lune/builtins/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lune/builtins/mod.rs b/src/lune/builtins/mod.rs index 46aefbe5..312305df 100644 --- a/src/lune/builtins/mod.rs +++ b/src/lune/builtins/mod.rs @@ -6,6 +6,7 @@ pub mod serde; pub mod stdio; pub mod task; pub mod top_level; +pub mod date_time; #[cfg(feature = "roblox")] pub mod roblox; From c11c05981a885c891001ccae0fe1b75146312e31 Mon Sep 17 00:00:00 2001 From: Compey Date: Fri, 25 Aug 2023 21:44:00 +0530 Subject: [PATCH 17/62] feat: export most of the DateTime functionality to luau --- src/lune/builtins/datetime/mod.rs | 136 ++++++++++++++++++++++++++++++ src/lune/builtins/mod.rs | 5 ++ 2 files changed, 141 insertions(+) diff --git a/src/lune/builtins/datetime/mod.rs b/src/lune/builtins/datetime/mod.rs index 3541664a..dce42092 100644 --- a/src/lune/builtins/datetime/mod.rs +++ b/src/lune/builtins/datetime/mod.rs @@ -1,9 +1,43 @@ +use crate::lune::builtins::LuaUserData; +use crate::lune::util::TableBuilder; use chrono::prelude::*; use chrono::DateTime as ChronoDateTime; use chrono_locale::LocaleDate; +use mlua::prelude::*; use once_cell::sync::Lazy; // TODO: Proper error handling and stuff +// TODO: fromUniversalTime, fromLocalTime, toDateTimeBuilder, toLocalTime, toUniversalTime +// FIX: DateTime::from_iso_date is broken + +// pub fn format_time(&self, timezone: Timezone, fmt_str: T, locale: T) -> String +// where +// T: ToString, +pub fn create(lua: &'static Lua) -> LuaResult { + TableBuilder::new(lua)? + .with_function("now", |_, ()| Ok(DateTime::now()))? + .with_function("fromUnixTimestamp", |lua, (timestamp_type, timestamp)| { + Ok(DateTime::from_unix_timestamp( + TimestampType::from_lua(timestamp_type, lua)?, + timestamp, + )) + })? + .with_function("fromIsoDate", |_, iso_date: LuaString| { + Ok(DateTime::from_iso_date(iso_date.to_string_lossy())) + })? + .with_function("toIsoDate", |_, this| Ok(DateTime::to_iso_date(&this)))? + .with_function( + "formatTime", + |_, (this, timezone, fmt_str, locale): (DateTime, LuaValue, LuaString, LuaString)| { + Ok(this.format_time( + Timezone::from_lua(timezone, lua)?, + fmt_str.to_string_lossy(), + locale.to_string_lossy(), + )) + }, + )? + .build_readonly() +} /// Possible types of timestamps accepted by `DateTime`. pub enum TimestampType { @@ -11,6 +45,32 @@ pub enum TimestampType { Millis, } +impl<'lua> FromLua<'lua> for TimestampType { + fn from_lua(value: LuaValue<'lua>, _: &'lua Lua) -> LuaResult { + fn num_to_enum(num: i32) -> LuaResult { + match num { + 1 => Ok(TimestampType::Seconds), + 2 => Ok(TimestampType::Millis), + _ => Err(LuaError::external("Invalid enum member!")), + } + } + + match value { + LuaValue::Integer(num) => num_to_enum(num), + LuaValue::Number(num) => num_to_enum(num as i32), + LuaValue::String(str) => match str.to_str()?.to_lowercase().as_str() { + "seconds" | "sec" | "secs" => Ok(TimestampType::Seconds), + "millis" | "milliseconds" | "milli" => Ok(TimestampType::Millis), + &_ => Err(LuaError::external("Invalid enum member!")), + }, + _ => Err(LuaError::external( + "Invalid enum type, number or string expected", + )), + } + } +} + +#[derive(Clone)] pub struct DateTime { /// The number of **seconds** since January 1st, 1970 /// at 00:00 UTC (the Unix epoch). Range is @@ -236,6 +296,55 @@ impl DateTime { } } +impl LuaUserData for DateTime { + fn add_fields<'lua, F: LuaUserDataFields<'lua, Self>>(fields: &mut F) { + fields.add_field_method_get("unixTimestamp", |_, this| Ok(this.unix_timestamp)); + fields.add_field_method_get("unixTimestampMillis", |_, this| { + Ok(this.unix_timestamp_millis) + }); + + fields.add_field_method_set("unixTimestamp", |_, this, val| { + this.unix_timestamp = val; + + Ok(()) + }); + + fields.add_field_method_set("unixTimestampMillis", |_, this, val| { + this.unix_timestamp_millis = val; + + Ok(()) + }); + } + + fn add_methods<'lua, M: LuaUserDataMethods<'lua, Self>>(methods: &mut M) { + methods.add_method("now", |_, _this, ()| Ok(DateTime::now())); + methods.add_method("toIsoDate", |_, this, ()| Ok(this.to_iso_date())); + methods.add_method( + "formatTime", + |_, this, (timezone, fmt_str, locale): (LuaValue, LuaString, LuaString)| { + Ok(this.format_time( + Timezone::from_lua(timezone, &Lua::new())?, + fmt_str.to_string_lossy(), + locale.to_string_lossy(), + )) + }, + ); + } +} + +impl<'lua> FromLua<'lua> for DateTime { + fn from_lua(value: LuaValue<'lua>, _: &'lua Lua) -> LuaResult { + match value { + LuaValue::Nil => panic!("found nil"), + LuaValue::Table(t) => Ok(DateTime::from_unix_timestamp( + TimestampType::Seconds, + t.get("unixTimestamp")?, + )), + _ => panic!("invalid type"), + } + } +} + pub struct DateTimeBuilder { /// The year. In the range 1400 - 9999. pub year: i32, @@ -274,6 +383,31 @@ pub enum Timezone { Local, } +impl<'lua> FromLua<'lua> for Timezone { + fn from_lua(value: LuaValue<'lua>, _: &'lua Lua) -> LuaResult { + fn num_to_enum(num: i32) -> LuaResult { + match num { + 1 => Ok(Timezone::Utc), + 2 => Ok(Timezone::Local), + _ => Err(LuaError::external("Invalid enum member!")), + } + } + + match value { + LuaValue::Integer(num) => num_to_enum(num), + LuaValue::Number(num) => num_to_enum(num as i32), + LuaValue::String(str) => match str.to_str()?.to_lowercase().as_str() { + "utc" => Ok(Timezone::Utc), + "local" => Ok(Timezone::Local), + &_ => Err(LuaError::external("Invalid enum member!")), + }, + _ => Err(LuaError::external( + "Invalid enum type, number or string expected", + )), + } + } +} + impl DateTimeBuilder { /// Builder method to set the `Year`. pub fn with_year(&mut self, year: i32) -> &mut Self { @@ -373,3 +507,5 @@ impl DateTimeBuilder { } } } + +impl LuaUserData for DateTimeBuilder {} diff --git a/src/lune/builtins/mod.rs b/src/lune/builtins/mod.rs index 2fc47cf1..f9aa1017 100644 --- a/src/lune/builtins/mod.rs +++ b/src/lune/builtins/mod.rs @@ -2,6 +2,7 @@ use std::str::FromStr; use mlua::prelude::*; +mod datetime; mod fs; mod luau; mod net; @@ -15,6 +16,7 @@ mod roblox; #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum LuneBuiltin { + DateTime, Fs, Luau, Net, @@ -32,6 +34,7 @@ where { pub fn name(&self) -> &'static str { match self { + Self::DateTime => "datetime", Self::Fs => "fs", Self::Luau => "luau", Self::Net => "net", @@ -46,6 +49,7 @@ where pub fn create(&self, lua: &'lua Lua) -> LuaResult> { let res = match self { + Self::DateTime => datetime::create(lua), Self::Fs => fs::create(lua), Self::Luau => luau::create(lua), Self::Net => net::create(lua), @@ -70,6 +74,7 @@ impl FromStr for LuneBuiltin { type Err = String; fn from_str(s: &str) -> Result { match s.trim().to_ascii_lowercase().as_str() { + "datetime" => Ok(Self::DateTime), "fs" => Ok(Self::Fs), "luau" => Ok(Self::Luau), "net" => Ok(Self::Net), From 83eeb77a6a6ab91d1d4a6037e1d817a38727992e Mon Sep 17 00:00:00 2001 From: Compey Date: Sat, 26 Aug 2023 15:44:07 +0530 Subject: [PATCH 18/62] feat: replace enums with floats for timestamps in millis --- src/lune/builtins/datetime/mod.rs | 50 +++++++++++++++++-------------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/src/lune/builtins/datetime/mod.rs b/src/lune/builtins/datetime/mod.rs index dce42092..f8cd5368 100644 --- a/src/lune/builtins/datetime/mod.rs +++ b/src/lune/builtins/datetime/mod.rs @@ -16,11 +16,26 @@ use once_cell::sync::Lazy; pub fn create(lua: &'static Lua) -> LuaResult { TableBuilder::new(lua)? .with_function("now", |_, ()| Ok(DateTime::now()))? - .with_function("fromUnixTimestamp", |lua, (timestamp_type, timestamp)| { - Ok(DateTime::from_unix_timestamp( - TimestampType::from_lua(timestamp_type, lua)?, - timestamp, - )) + .with_function("fromUnixTimestamp", |lua, timestamp: LuaValue| { + let timestamp_cloned = timestamp.clone(); + let timestamp_kind = TimestampType::from_lua(timestamp, lua)?; + let timestamp = match timestamp_kind { + TimestampType::Seconds => timestamp_cloned.as_i64().unwrap(), + TimestampType::Millis => { + // FIXME: Remove the unwrap + // If something breaks, blame this. + // FIX: Decimal values cause panic, "no such local time". + let timestamp = timestamp_cloned.as_f64().unwrap(); + + (((timestamp - timestamp.fract()) * 1000_f64) // converting the whole seconds part to millis + + timestamp.fract() * ((10_u64.pow(timestamp.fract().to_string().split('.').collect::>()[1].len() as u32)) as f64)) as i64 + // adding the millis to the fract as a whole number + // HACK: 10 * (timestamp.fract().to_string().len() - 2) gives us the number of digits + // after the decimal + } + }; + + Ok(DateTime::from_unix_timestamp(timestamp_kind, timestamp)) })? .with_function("fromIsoDate", |_, iso_date: LuaString| { Ok(DateTime::from_iso_date(iso_date.to_string_lossy())) @@ -44,27 +59,18 @@ pub enum TimestampType { Seconds, Millis, } - +// get fraction from f32 impl<'lua> FromLua<'lua> for TimestampType { fn from_lua(value: LuaValue<'lua>, _: &'lua Lua) -> LuaResult { - fn num_to_enum(num: i32) -> LuaResult { - match num { - 1 => Ok(TimestampType::Seconds), - 2 => Ok(TimestampType::Millis), - _ => Err(LuaError::external("Invalid enum member!")), - } - } - match value { - LuaValue::Integer(num) => num_to_enum(num), - LuaValue::Number(num) => num_to_enum(num as i32), - LuaValue::String(str) => match str.to_str()?.to_lowercase().as_str() { - "seconds" | "sec" | "secs" => Ok(TimestampType::Seconds), - "millis" | "milliseconds" | "milli" => Ok(TimestampType::Millis), - &_ => Err(LuaError::external("Invalid enum member!")), - }, + LuaValue::Integer(_) => Ok(TimestampType::Seconds), + LuaValue::Number(num) => Ok(if num.fract() == 0.0 { + TimestampType::Seconds + } else { + TimestampType::Millis + }), _ => Err(LuaError::external( - "Invalid enum type, number or string expected", + "Invalid enum type, number or integer expected", )), } } From 574bc16a1beda4f6b5020e213c9dc5a57a2e867f Mon Sep 17 00:00:00 2001 From: Compey Date: Sat, 26 Aug 2023 18:54:47 +0530 Subject: [PATCH 19/62] feat: implement luau side for more functions The following was implemented: * trait FromLua for DateTimeBuilder * trait UserDate for DateTimeBuilder * toUniversalTime * fromUniversalTime --- src/lune/builtins/datetime/mod.rs | 54 +++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/src/lune/builtins/datetime/mod.rs b/src/lune/builtins/datetime/mod.rs index f8cd5368..3f7a54d4 100644 --- a/src/lune/builtins/datetime/mod.rs +++ b/src/lune/builtins/datetime/mod.rs @@ -7,7 +7,7 @@ use mlua::prelude::*; use once_cell::sync::Lazy; // TODO: Proper error handling and stuff -// TODO: fromUniversalTime, fromLocalTime, toDateTimeBuilder, toLocalTime, toUniversalTime +// TODO: fromLocalTime, toDateTimeBuilder, toLocalTime // FIX: DateTime::from_iso_date is broken // pub fn format_time(&self, timezone: Timezone, fmt_str: T, locale: T) -> String @@ -37,6 +37,12 @@ pub fn create(lua: &'static Lua) -> LuaResult { Ok(DateTime::from_unix_timestamp(timestamp_kind, timestamp)) })? + .with_function("fromUniversalTime", |lua, date_time: LuaValue| { + Ok(DateTime::from_universal_time(DateTimeBuilder::from_lua(date_time, lua).ok())) + })? + .with_function("toUniversalTime", |_, this: DateTime| { + Ok(this.to_universal_time()) + })? .with_function("fromIsoDate", |_, iso_date: LuaString| { Ok(DateTime::from_iso_date(iso_date.to_string_lossy())) })? @@ -335,6 +341,9 @@ impl LuaUserData for DateTime { )) }, ); + methods.add_method("toUniversalTime", |_, this: &DateTime, ()| { + Ok(this.to_universal_time()) + }) } } @@ -351,6 +360,7 @@ impl<'lua> FromLua<'lua> for DateTime { } } +#[derive(Copy, Clone)] pub struct DateTimeBuilder { /// The year. In the range 1400 - 9999. pub year: i32, @@ -465,7 +475,7 @@ impl DateTimeBuilder { } /// Converts the `DateTimeBuilder` to a string with a specified format and locale. - fn to_string(&self, timezone: Timezone, format: Option, locale: Option) -> String + fn to_string(self, timezone: Timezone, format: Option, locale: Option) -> String where T: ToString, { @@ -512,6 +522,46 @@ impl DateTimeBuilder { .to_string(), } } + + fn build(self) -> Self { + self + } } impl LuaUserData for DateTimeBuilder {} + +impl<'lua> FromLua<'lua> for DateTimeBuilder { + fn from_lua(value: LuaValue<'lua>, _: &'lua Lua) -> LuaResult { + match value { + LuaValue::Table(t) => Ok(Self::default() + .with_year(t.get("year")?) + // FIXME: Months are offset by two, months start on march for some reason... + .with_month( + (match t.get("month")? { + LuaValue::String(str) => Ok(str.to_str()?.parse::().or(Err( + LuaError::external("could not cast month string to Month"), + ))?), + LuaValue::Nil => { + Err(LuaError::external("cannot find mandatory month argument")) + } + LuaValue::Number(num) => Ok(Month::try_from(num as u8).or(Err( + LuaError::external("could not cast month number to Month"), + ))?), + LuaValue::Integer(int) => Ok(Month::try_from(int as u8).or(Err( + LuaError::external("could not cast month integer to Month"), + ))?), + _ => Err(LuaError::external("unexpected month field type")), + })?, + ) + .with_day(t.get("day")?) + .with_hour(t.get("hour")?) + .with_minute(t.get("minute")?) + .with_second(t.get("second")?) + // TODO: millisecond support + .build()), + _ => Err(LuaError::external( + "expected type table for DateTimeBuilder", + )), + } + } +} From 6943ed07553c18460bc7c046f90de43a4e73d94c Mon Sep 17 00:00:00 2001 From: Compey Date: Sat, 26 Aug 2023 20:44:06 +0530 Subject: [PATCH 20/62] feat: finish luau side implementation This commit finishes the DateTime implementation for the luau side library. It includes the following methods: * fromLocalTime * toLocalTime --- src/lune/builtins/datetime/mod.rs | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/lune/builtins/datetime/mod.rs b/src/lune/builtins/datetime/mod.rs index 3f7a54d4..a0bbc63a 100644 --- a/src/lune/builtins/datetime/mod.rs +++ b/src/lune/builtins/datetime/mod.rs @@ -7,12 +7,9 @@ use mlua::prelude::*; use once_cell::sync::Lazy; // TODO: Proper error handling and stuff -// TODO: fromLocalTime, toDateTimeBuilder, toLocalTime +// TODO: fromLocalTime, toLocalTime // FIX: DateTime::from_iso_date is broken -// pub fn format_time(&self, timezone: Timezone, fmt_str: T, locale: T) -> String -// where -// T: ToString, pub fn create(lua: &'static Lua) -> LuaResult { TableBuilder::new(lua)? .with_function("now", |_, ()| Ok(DateTime::now()))? @@ -43,6 +40,12 @@ pub fn create(lua: &'static Lua) -> LuaResult { .with_function("toUniversalTime", |_, this: DateTime| { Ok(this.to_universal_time()) })? + .with_function("fromLocalTime", |lua, date_time: LuaValue| { + Ok(DateTime::from_local_time(DateTimeBuilder::from_lua(date_time, lua).ok())) + })? + .with_function("toLocalTime", |_, this: DateTime| { + Ok(this.to_local_time()) + })? .with_function("fromIsoDate", |_, iso_date: LuaString| { Ok(DateTime::from_iso_date(iso_date.to_string_lossy())) })? @@ -330,7 +333,9 @@ impl LuaUserData for DateTime { fn add_methods<'lua, M: LuaUserDataMethods<'lua, Self>>(methods: &mut M) { methods.add_method("now", |_, _this, ()| Ok(DateTime::now())); + methods.add_method("toIsoDate", |_, this, ()| Ok(this.to_iso_date())); + methods.add_method( "formatTime", |_, this, (timezone, fmt_str, locale): (LuaValue, LuaString, LuaString)| { @@ -341,9 +346,14 @@ impl LuaUserData for DateTime { )) }, ); + methods.add_method("toUniversalTime", |_, this: &DateTime, ()| { Ok(this.to_universal_time()) - }) + }); + + methods.add_method("toLocalTime", |_, this: &DateTime, ()| { + Ok(this.to_local_time()) + }); } } @@ -434,7 +444,8 @@ impl DateTimeBuilder { /// Builder method to set the `Month`. pub fn with_month(&mut self, month: Month) -> &mut Self { - self.month = month as u32; + // THe Month enum casts to u32 starting at zero, so we add one to it + self.month = month as u32 + 1; self } From dd1c43c4949aa33b793a265216640914ab03b257 Mon Sep 17 00:00:00 2001 From: Compey Date: Sat, 26 Aug 2023 21:06:44 +0530 Subject: [PATCH 21/62] refactor: breakup datetime into multiple modules --- src/lune/builtins/datetime/builder.rs | 206 +++++++++++ src/lune/builtins/datetime/date_time.rs | 241 +++++++++++++ src/lune/builtins/datetime/mod.rs | 455 +----------------------- 3 files changed, 456 insertions(+), 446 deletions(-) create mode 100644 src/lune/builtins/datetime/builder.rs create mode 100644 src/lune/builtins/datetime/date_time.rs diff --git a/src/lune/builtins/datetime/builder.rs b/src/lune/builtins/datetime/builder.rs new file mode 100644 index 00000000..5f963f55 --- /dev/null +++ b/src/lune/builtins/datetime/builder.rs @@ -0,0 +1,206 @@ +use crate::lune::builtins::datetime::date_time::Timezone; +use chrono::prelude::*; +use chrono_locale::LocaleDate; +use mlua::prelude::*; +use once_cell::sync::Lazy; + +#[derive(Copy, Clone)] +pub struct DateTimeBuilder { + /// The year. In the range 1400 - 9999. + pub year: i32, + /// The month. In the range 1 - 12. + pub month: u32, + /// The day. In the range 1 - 31. + pub day: u32, + /// The hour. In the range 0 - 23. + pub hour: u32, + /// The minute. In the range 0 - 59. + pub minute: u32, + /// The second. In the range usually 0 - 59, but sometimes 0 - 60 to accommodate leap seconds in certain systems. + pub second: u32, + /// The milliseconds. In the range 0 - 999. + pub millisecond: u32, +} + +impl Default for DateTimeBuilder { + /// Constructs the default state for DateTimeBuilder, which is the Unix Epoch. + fn default() -> Self { + Self { + year: 1970, + month: 1, + day: 1, + hour: 0, + minute: 0, + second: 0, + millisecond: 0, + } + } +} + +impl<'lua> FromLua<'lua> for Timezone { + fn from_lua(value: LuaValue<'lua>, _: &'lua Lua) -> LuaResult { + fn num_to_enum(num: i32) -> LuaResult { + match num { + 1 => Ok(Timezone::Utc), + 2 => Ok(Timezone::Local), + _ => Err(LuaError::external("Invalid enum member!")), + } + } + + match value { + LuaValue::Integer(num) => num_to_enum(num), + LuaValue::Number(num) => num_to_enum(num as i32), + LuaValue::String(str) => match str.to_str()?.to_lowercase().as_str() { + "utc" => Ok(Timezone::Utc), + "local" => Ok(Timezone::Local), + &_ => Err(LuaError::external("Invalid enum member!")), + }, + _ => Err(LuaError::external( + "Invalid enum type, number or string expected", + )), + } + } +} + +impl DateTimeBuilder { + /// Builder method to set the `Year`. + pub fn with_year(&mut self, year: i32) -> &mut Self { + self.year = year; + + self + } + + /// Builder method to set the `Month`. + pub fn with_month(&mut self, month: Month) -> &mut Self { + // THe Month enum casts to u32 starting at zero, so we add one to it + self.month = month as u32 + 1; + + self + } + + /// Builder method to set the `Month`. + pub fn with_day(&mut self, day: u32) -> &mut Self { + self.day = day; + + self + } + + /// Builder method to set the `Hour`. + pub fn with_hour(&mut self, hour: u32) -> &mut Self { + self.hour = hour; + + self + } + + /// Builder method to set the `Minute`. + pub fn with_minute(&mut self, minute: u32) -> &mut Self { + self.minute = minute; + + self + } + + /// Builder method to set the `Second`. + pub fn with_second(&mut self, second: u32) -> &mut Self { + self.second = second; + + self + } + + /// Builder method to set the `Millisecond`. + pub fn with_millisecond(&mut self, millisecond: u32) -> &mut Self { + self.millisecond = millisecond; + + self + } + + /// Converts the `DateTimeBuilder` to a string with a specified format and locale. + pub fn to_string(self, timezone: Timezone, format: Option, locale: Option) -> String + where + T: ToString, + { + let format_lazy: Lazy = Lazy::new(|| { + if let Some(fmt) = format { + fmt.to_string() + } else { + "%Y-%m-%dT%H:%M:%SZ".to_string() + } + }); + + let locale_lazy: Lazy = Lazy::new(|| { + if let Some(locale) = locale { + locale.to_string() + } else { + "en".to_string() + } + }); + + match timezone { + Timezone::Utc => Utc + .with_ymd_and_hms( + self.year, + self.month, + self.day, + self.hour, + self.minute, + self.second, + ) + .unwrap() + .formatl((*format_lazy).as_str(), (*locale_lazy).as_str()) + .to_string(), + Timezone::Local => Local + .with_ymd_and_hms( + self.year, + self.month, + self.day, + self.hour, + self.minute, + self.second, + ) + .unwrap() + .formatl((*format_lazy).as_str(), (*locale_lazy).as_str()) + .to_string(), + } + } + + fn build(self) -> Self { + self + } +} + +impl LuaUserData for DateTimeBuilder {} + +impl<'lua> FromLua<'lua> for DateTimeBuilder { + fn from_lua(value: LuaValue<'lua>, _: &'lua Lua) -> LuaResult { + match value { + LuaValue::Table(t) => Ok(Self::default() + .with_year(t.get("year")?) + // FIXME: Months are offset by two, months start on march for some reason... + .with_month( + (match t.get("month")? { + LuaValue::String(str) => Ok(str.to_str()?.parse::().or(Err( + LuaError::external("could not cast month string to Month"), + ))?), + LuaValue::Nil => { + Err(LuaError::external("cannot find mandatory month argument")) + } + LuaValue::Number(num) => Ok(Month::try_from(num as u8).or(Err( + LuaError::external("could not cast month number to Month"), + ))?), + LuaValue::Integer(int) => Ok(Month::try_from(int as u8).or(Err( + LuaError::external("could not cast month integer to Month"), + ))?), + _ => Err(LuaError::external("unexpected month field type")), + })?, + ) + .with_day(t.get("day")?) + .with_hour(t.get("hour")?) + .with_minute(t.get("minute")?) + .with_second(t.get("second")?) + // TODO: millisecond support + .build()), + _ => Err(LuaError::external( + "expected type table for DateTimeBuilder", + )), + } + } +} diff --git a/src/lune/builtins/datetime/date_time.rs b/src/lune/builtins/datetime/date_time.rs new file mode 100644 index 00000000..3e95a253 --- /dev/null +++ b/src/lune/builtins/datetime/date_time.rs @@ -0,0 +1,241 @@ +use crate::lune::builtins::datetime::builder::DateTimeBuilder; +use chrono::prelude::*; +use chrono::DateTime as ChronoDateTime; + +/// Possible types of timestamps accepted by `DateTime`. +pub enum TimestampType { + Seconds, + Millis, +} + +/// General timezone types accepted by `DateTime` methods. +pub enum Timezone { + Utc, + Local, +} + +#[derive(Clone)] +pub struct DateTime { + /// The number of **seconds** since January 1st, 1970 + /// at 00:00 UTC (the Unix epoch). Range is + /// -17,987,443,200 to 253,402,300,799, approximately + /// years 1400–9999. + pub unix_timestamp: i64, + + /// The number of **milliseconds* since January 1st, 1970 + /// at 00:00 UTC (the Unix epoch). Range is -17,987,443,200,000 + /// to 253,402,300,799,999, approximately years 1400–9999. + pub unix_timestamp_millis: i64, +} + +impl DateTime { + /// Returns a `DateTime` representing the current moment in time. + pub fn now() -> Self { + let time = Utc::now(); + + Self { + unix_timestamp: time.timestamp(), + unix_timestamp_millis: time.timestamp_millis(), + } + } + + /// Returns a new `DateTime` object from the given unix timestamp, in either seconds on + /// milliseconds. In case of failure, defaults to the (seconds or + /// milliseconds) since January 1st, 1970 at 00:00 (UTC). + pub fn from_unix_timestamp(timestamp_kind: TimestampType, unix_timestamp: i64) -> Self { + let time_chrono = match timestamp_kind { + TimestampType::Seconds => NaiveDateTime::from_timestamp_opt(unix_timestamp, 0), + TimestampType::Millis => NaiveDateTime::from_timestamp_millis(unix_timestamp), + }; + + if let Some(time) = time_chrono { + Self { + unix_timestamp: time.timestamp(), + unix_timestamp_millis: time.timestamp_millis(), + } + } else { + Self::now() + } + } + + /// Returns a new `DateTime` using the given units from a UTC time. The + /// values accepted are similar to those found in the time value table + /// returned by `to_universal_time`. + /// + /// - Date units (year, month, day) that produce an invalid date will raise an error. For example, January 32nd or February 29th on a non-leap year. + /// - Time units (hour, minute, second, millisecond) that are outside their normal range are valid. For example, 90 minutes will cause the hour to roll over by 1; -10 seconds will cause the minute value to roll back by 1. + /// - Non-integer values are rounded down. For example, providing 2.5 hours will be equivalent to providing 2 hours, not 2 hours 30 minutes. + /// - Omitted values are assumed to be their lowest value in their normal range, except for year which defaults to 1970. + pub fn from_universal_time(date_time: Option) -> Self { + if let Some(date_time) = date_time { + let utc_time: ChronoDateTime = Utc.from_utc_datetime(&NaiveDateTime::new( + NaiveDate::from_ymd_opt(date_time.year, date_time.month, date_time.day) + .expect("invalid date"), + NaiveTime::from_hms_milli_opt( + date_time.hour, + date_time.minute, + date_time.second, + date_time.millisecond, + ) + .expect("invalid time"), + )); + + Self { + unix_timestamp: utc_time.timestamp(), + unix_timestamp_millis: utc_time.timestamp_millis(), + } + } else { + let utc_time = Utc::now(); + + Self { + unix_timestamp: utc_time.timestamp(), + unix_timestamp_millis: utc_time.timestamp_millis(), + } + } + } + + /// Returns a new `DateTime` using the given units from a UTC time. The + /// values accepted are similar to those found in the time value table + /// returned by `to_local_time`. + /// + /// - Date units (year, month, day) that produce an invalid date will raise an error. For example, January 32nd or February 29th on a non-leap year. + /// - Time units (hour, minute, second, millisecond) that are outside their normal range are valid. For example, 90 minutes will cause the hour to roll over by 1; -10 seconds will cause the minute value to roll back by 1. + /// - Non-integer values are rounded down. For example, providing 2.5 hours will be equivalent to providing 2 hours, not 2 hours 30 minutes. + /// - Omitted values are assumed to be their lowest value in their normal range, except for year which defaults to 1970. + pub fn from_local_time(date_time: Option) -> Self { + if let Some(date_time) = date_time { + let local_time: ChronoDateTime = Local + .from_local_datetime(&NaiveDateTime::new( + NaiveDate::from_ymd_opt(date_time.year, date_time.month, date_time.day) + .expect("invalid date"), + NaiveTime::from_hms_milli_opt( + date_time.hour, + date_time.minute, + date_time.second, + date_time.millisecond, + ) + .expect("invalid time"), + )) + .unwrap(); + + Self { + unix_timestamp: local_time.timestamp(), + unix_timestamp_millis: local_time.timestamp_millis(), + } + } else { + let local_time = Local::now(); + + Self { + unix_timestamp: local_time.timestamp(), + unix_timestamp_millis: local_time.timestamp_millis(), + } + } + } + + /// Returns a `DateTime` from an ISO 8601 date-time string in UTC + /// time, such as those returned by `to_iso_date`. If the + /// string parsing fails, the function returns `None`. + /// + /// An example ISO 8601 date-time string would be `2020-01-02T10:30:45Z`, + /// which represents January 2nd 2020 at 10:30 AM, 45 seconds. + pub fn from_iso_date(iso_date: T) -> Option + where + T: ToString, + { + let time = + ChronoDateTime::parse_from_str(iso_date.to_string().as_str(), "%Y-%m-%dT%H:%M:%SZ") + .ok()?; + + Some(Self { + unix_timestamp: time.timestamp(), + unix_timestamp_millis: time.timestamp_millis(), + }) + } + + /// Converts the value of this `DateTime` object to local time. The returned table + /// contains the following keys: `Year`, `Month`, `Day`, `Hour`, `Minute`, `Second`, + /// `Millisecond`. For more details, see the time value table in this data type's + /// description. The values within this table could be passed to `from_local_time` + /// to produce the original `DateTime` object. + pub fn to_datetime_builder(date_time: ChronoDateTime) -> DateTimeBuilder + where + T: TimeZone, + { + let mut date_time_constructor = DateTimeBuilder::default(); + + // Any less tedious way to get Enum member based on index? + // I know there's some crates available with derive macros for this, + // would it be okay if used some of them? + date_time_constructor + .with_year(date_time.year()) + .with_month(match date_time.month() { + 1 => Month::January, + 2 => Month::February, + 3 => Month::March, + 4 => Month::April, + 5 => Month::May, + 6 => Month::June, + 7 => Month::July, + 8 => Month::August, + 9 => Month::September, + 10 => Month::October, + 11 => Month::November, + 12 => Month::December, + _ => panic!("invalid month ordinal"), + }) + .with_day(date_time.day()) + .with_hour(date_time.hour()) + .with_minute(date_time.minute()) + .with_second(date_time.second()); + + date_time_constructor + } + + /// Converts the value of this `DateTime` object to local time. The returned table + /// contains the following keys: `Year`, `Month`, `Day`, `Hour`, `Minute`, `Second`, + /// `Millisecond`. For more details, see the time value table in this data type's + /// description. The values within this table could be passed to `from_local_time` + /// to produce the original `DateTime` object. + pub fn to_local_time(&self) -> DateTimeBuilder { + Self::to_datetime_builder(Local.timestamp_opt(self.unix_timestamp, 0).unwrap()) + } + + /// Converts the value of this `DateTime` object to Universal Coordinated Time (UTC). + /// The returned table contains the following keys: `Year`, `Month`, `Day`, `Hour`, + /// `Minute`, `Second`, `Millisecond`. For more details, see the time value table + /// in this data type's description. The values within this table could be passed + /// to `from_universal_time` to produce the original `DateTime` object. + pub fn to_universal_time(&self) -> DateTimeBuilder { + Self::to_datetime_builder(Utc.timestamp_opt(self.unix_timestamp, 0).unwrap()) + } + + /// Formats a date as a ISO 8601 date-time string. The value returned by this + /// function could be passed to `from_local_time` to produce the original `DateTime` + /// object. + pub fn to_iso_date(&self) -> String { + self.to_universal_time() + .to_string::<&str>(Timezone::Utc, None, None) + } + + // There seems to be only one localization crate for chrono, + // which has been committed to last 5 years ago. Thus, this crate doesn't + // work with the version of chrono we're using. I've forked the crate + // and have made it compatible with the latest version of chrono. ~ DevComp + + // TODO: Implement more locales for chrono-locale. + + /// Generates a string from the `DateTime` value interpreted as **local time** + /// and a format string. The format string should contain tokens, which will + /// replace to certain date/time values described by the `DateTime` object. + /// For more details, see the [accepted formatter tokens](https://docs.rs/chrono/latest/chrono/format/strftime/index.html). + pub fn format_time(&self, timezone: Timezone, fmt_str: T, locale: T) -> String + where + T: ToString, + { + self.to_universal_time().to_string( + timezone, + Some(fmt_str.to_string()), + Some(locale.to_string()), + ) + } +} diff --git a/src/lune/builtins/datetime/mod.rs b/src/lune/builtins/datetime/mod.rs index a0bbc63a..6f04f60c 100644 --- a/src/lune/builtins/datetime/mod.rs +++ b/src/lune/builtins/datetime/mod.rs @@ -1,13 +1,15 @@ -use crate::lune::builtins::LuaUserData; -use crate::lune::util::TableBuilder; -use chrono::prelude::*; -use chrono::DateTime as ChronoDateTime; -use chrono_locale::LocaleDate; use mlua::prelude::*; -use once_cell::sync::Lazy; + +pub(crate) mod builder; +pub(crate) mod date_time; + +use self::{ + builder::DateTimeBuilder, + date_time::{DateTime, TimestampType, Timezone}, +}; +use crate::lune::util::TableBuilder; // TODO: Proper error handling and stuff -// TODO: fromLocalTime, toLocalTime // FIX: DateTime::from_iso_date is broken pub fn create(lua: &'static Lua) -> LuaResult { @@ -63,12 +65,6 @@ pub fn create(lua: &'static Lua) -> LuaResult { .build_readonly() } -/// Possible types of timestamps accepted by `DateTime`. -pub enum TimestampType { - Seconds, - Millis, -} -// get fraction from f32 impl<'lua> FromLua<'lua> for TimestampType { fn from_lua(value: LuaValue<'lua>, _: &'lua Lua) -> LuaResult { match value { @@ -85,232 +81,6 @@ impl<'lua> FromLua<'lua> for TimestampType { } } -#[derive(Clone)] -pub struct DateTime { - /// The number of **seconds** since January 1st, 1970 - /// at 00:00 UTC (the Unix epoch). Range is - /// -17,987,443,200 to 253,402,300,799, approximately - /// years 1400–9999. - pub unix_timestamp: i64, - - /// The number of **milliseconds* since January 1st, 1970 - /// at 00:00 UTC (the Unix epoch). Range is -17,987,443,200,000 - /// to 253,402,300,799,999, approximately years 1400–9999. - pub unix_timestamp_millis: i64, -} - -impl DateTime { - /// Returns a `DateTime` representing the current moment in time. - pub fn now() -> Self { - let time = Utc::now(); - - Self { - unix_timestamp: time.timestamp(), - unix_timestamp_millis: time.timestamp_millis(), - } - } - - /// Returns a new `DateTime` object from the given unix timestamp, in either seconds on - /// milliseconds. In case of failure, defaults to the (seconds or - /// milliseconds) since January 1st, 1970 at 00:00 (UTC). - pub fn from_unix_timestamp(timestamp_kind: TimestampType, unix_timestamp: i64) -> Self { - let time_chrono = match timestamp_kind { - TimestampType::Seconds => NaiveDateTime::from_timestamp_opt(unix_timestamp, 0), - TimestampType::Millis => NaiveDateTime::from_timestamp_millis(unix_timestamp), - }; - - if let Some(time) = time_chrono { - Self { - unix_timestamp: time.timestamp(), - unix_timestamp_millis: time.timestamp_millis(), - } - } else { - Self::now() - } - } - - /// Returns a new `DateTime` using the given units from a UTC time. The - /// values accepted are similar to those found in the time value table - /// returned by `to_universal_time`. - /// - /// - Date units (year, month, day) that produce an invalid date will raise an error. For example, January 32nd or February 29th on a non-leap year. - /// - Time units (hour, minute, second, millisecond) that are outside their normal range are valid. For example, 90 minutes will cause the hour to roll over by 1; -10 seconds will cause the minute value to roll back by 1. - /// - Non-integer values are rounded down. For example, providing 2.5 hours will be equivalent to providing 2 hours, not 2 hours 30 minutes. - /// - Omitted values are assumed to be their lowest value in their normal range, except for year which defaults to 1970. - pub fn from_universal_time(date_time: Option) -> Self { - if let Some(date_time) = date_time { - let utc_time: ChronoDateTime = Utc.from_utc_datetime(&NaiveDateTime::new( - NaiveDate::from_ymd_opt(date_time.year, date_time.month, date_time.day) - .expect("invalid date"), - NaiveTime::from_hms_milli_opt( - date_time.hour, - date_time.minute, - date_time.second, - date_time.millisecond, - ) - .expect("invalid time"), - )); - - Self { - unix_timestamp: utc_time.timestamp(), - unix_timestamp_millis: utc_time.timestamp_millis(), - } - } else { - let utc_time = Utc::now(); - - Self { - unix_timestamp: utc_time.timestamp(), - unix_timestamp_millis: utc_time.timestamp_millis(), - } - } - } - - /// Returns a new `DateTime` using the given units from a UTC time. The - /// values accepted are similar to those found in the time value table - /// returned by `to_local_time`. - /// - /// - Date units (year, month, day) that produce an invalid date will raise an error. For example, January 32nd or February 29th on a non-leap year. - /// - Time units (hour, minute, second, millisecond) that are outside their normal range are valid. For example, 90 minutes will cause the hour to roll over by 1; -10 seconds will cause the minute value to roll back by 1. - /// - Non-integer values are rounded down. For example, providing 2.5 hours will be equivalent to providing 2 hours, not 2 hours 30 minutes. - /// - Omitted values are assumed to be their lowest value in their normal range, except for year which defaults to 1970. - pub fn from_local_time(date_time: Option) -> Self { - if let Some(date_time) = date_time { - let local_time: ChronoDateTime = Local - .from_local_datetime(&NaiveDateTime::new( - NaiveDate::from_ymd_opt(date_time.year, date_time.month, date_time.day) - .expect("invalid date"), - NaiveTime::from_hms_milli_opt( - date_time.hour, - date_time.minute, - date_time.second, - date_time.millisecond, - ) - .expect("invalid time"), - )) - .unwrap(); - - Self { - unix_timestamp: local_time.timestamp(), - unix_timestamp_millis: local_time.timestamp_millis(), - } - } else { - let local_time = Local::now(); - - Self { - unix_timestamp: local_time.timestamp(), - unix_timestamp_millis: local_time.timestamp_millis(), - } - } - } - - /// Returns a `DateTime` from an ISO 8601 date-time string in UTC - /// time, such as those returned by `to_iso_date`. If the - /// string parsing fails, the function returns `None`. - /// - /// An example ISO 8601 date-time string would be `2020-01-02T10:30:45Z`, - /// which represents January 2nd 2020 at 10:30 AM, 45 seconds. - pub fn from_iso_date(iso_date: T) -> Option - where - T: ToString, - { - let time = - ChronoDateTime::parse_from_str(iso_date.to_string().as_str(), "%Y-%m-%dT%H:%M:%SZ") - .ok()?; - - Some(Self { - unix_timestamp: time.timestamp(), - unix_timestamp_millis: time.timestamp_millis(), - }) - } - - /// Converts the value of this `DateTime` object to local time. The returned table - /// contains the following keys: `Year`, `Month`, `Day`, `Hour`, `Minute`, `Second`, - /// `Millisecond`. For more details, see the time value table in this data type's - /// description. The values within this table could be passed to `from_local_time` - /// to produce the original `DateTime` object. - pub fn to_datetime_builder(date_time: ChronoDateTime) -> DateTimeBuilder - where - T: TimeZone, - { - let mut date_time_constructor = DateTimeBuilder::default(); - - // Any less tedious way to get Enum member based on index? - // I know there's some crates available with derive macros for this, - // would it be okay if used some of them? - date_time_constructor - .with_year(date_time.year()) - .with_month(match date_time.month() { - 1 => Month::January, - 2 => Month::February, - 3 => Month::March, - 4 => Month::April, - 5 => Month::May, - 6 => Month::June, - 7 => Month::July, - 8 => Month::August, - 9 => Month::September, - 10 => Month::October, - 11 => Month::November, - 12 => Month::December, - _ => panic!("invalid month ordinal"), - }) - .with_day(date_time.day()) - .with_hour(date_time.hour()) - .with_minute(date_time.minute()) - .with_second(date_time.second()); - - date_time_constructor - } - - /// Converts the value of this `DateTime` object to local time. The returned table - /// contains the following keys: `Year`, `Month`, `Day`, `Hour`, `Minute`, `Second`, - /// `Millisecond`. For more details, see the time value table in this data type's - /// description. The values within this table could be passed to `from_local_time` - /// to produce the original `DateTime` object. - pub fn to_local_time(&self) -> DateTimeBuilder { - Self::to_datetime_builder(Local.timestamp_opt(self.unix_timestamp, 0).unwrap()) - } - - /// Converts the value of this `DateTime` object to Universal Coordinated Time (UTC). - /// The returned table contains the following keys: `Year`, `Month`, `Day`, `Hour`, - /// `Minute`, `Second`, `Millisecond`. For more details, see the time value table - /// in this data type's description. The values within this table could be passed - /// to `from_universal_time` to produce the original `DateTime` object. - pub fn to_universal_time(&self) -> DateTimeBuilder { - Self::to_datetime_builder(Utc.timestamp_opt(self.unix_timestamp, 0).unwrap()) - } - - /// Formats a date as a ISO 8601 date-time string. The value returned by this - /// function could be passed to `from_local_time` to produce the original `DateTime` - /// object. - pub fn to_iso_date(&self) -> String { - self.to_universal_time() - .to_string::<&str>(Timezone::Utc, None, None) - } - - // There seems to be only one localization crate for chrono, - // which has been committed to last 5 years ago. Thus, this crate doesn't - // work with the version of chrono we're using. I've forked the crate - // and have made it compatible with the latest version of chrono. ~ DevComp - - // TODO: Implement more locales for chrono-locale. - - /// Generates a string from the `DateTime` value interpreted as **local time** - /// and a format string. The format string should contain tokens, which will - /// replace to certain date/time values described by the `DateTime` object. - /// For more details, see the [accepted formatter tokens](https://docs.rs/chrono/latest/chrono/format/strftime/index.html). - pub fn format_time(&self, timezone: Timezone, fmt_str: T, locale: T) -> String - where - T: ToString, - { - self.to_universal_time().to_string( - timezone, - Some(fmt_str.to_string()), - Some(locale.to_string()), - ) - } -} - impl LuaUserData for DateTime { fn add_fields<'lua, F: LuaUserDataFields<'lua, Self>>(fields: &mut F) { fields.add_field_method_get("unixTimestamp", |_, this| Ok(this.unix_timestamp)); @@ -369,210 +139,3 @@ impl<'lua> FromLua<'lua> for DateTime { } } } - -#[derive(Copy, Clone)] -pub struct DateTimeBuilder { - /// The year. In the range 1400 - 9999. - pub year: i32, - /// The month. In the range 1 - 12. - pub month: u32, - /// The day. In the range 1 - 31. - pub day: u32, - /// The hour. In the range 0 - 23. - pub hour: u32, - /// The minute. In the range 0 - 59. - pub minute: u32, - /// The second. In the range usually 0 - 59, but sometimes 0 - 60 to accommodate leap seconds in certain systems. - pub second: u32, - /// The milliseconds. In the range 0 - 999. - pub millisecond: u32, -} - -impl Default for DateTimeBuilder { - /// Constructs the default state for DateTimeBuilder, which is the Unix Epoch. - fn default() -> Self { - Self { - year: 1970, - month: 1, - day: 1, - hour: 0, - minute: 0, - second: 0, - millisecond: 0, - } - } -} - -/// General timezone types accepted by `DateTime` methods. -pub enum Timezone { - Utc, - Local, -} - -impl<'lua> FromLua<'lua> for Timezone { - fn from_lua(value: LuaValue<'lua>, _: &'lua Lua) -> LuaResult { - fn num_to_enum(num: i32) -> LuaResult { - match num { - 1 => Ok(Timezone::Utc), - 2 => Ok(Timezone::Local), - _ => Err(LuaError::external("Invalid enum member!")), - } - } - - match value { - LuaValue::Integer(num) => num_to_enum(num), - LuaValue::Number(num) => num_to_enum(num as i32), - LuaValue::String(str) => match str.to_str()?.to_lowercase().as_str() { - "utc" => Ok(Timezone::Utc), - "local" => Ok(Timezone::Local), - &_ => Err(LuaError::external("Invalid enum member!")), - }, - _ => Err(LuaError::external( - "Invalid enum type, number or string expected", - )), - } - } -} - -impl DateTimeBuilder { - /// Builder method to set the `Year`. - pub fn with_year(&mut self, year: i32) -> &mut Self { - self.year = year; - - self - } - - /// Builder method to set the `Month`. - pub fn with_month(&mut self, month: Month) -> &mut Self { - // THe Month enum casts to u32 starting at zero, so we add one to it - self.month = month as u32 + 1; - - self - } - - /// Builder method to set the `Month`. - pub fn with_day(&mut self, day: u32) -> &mut Self { - self.day = day; - - self - } - - /// Builder method to set the `Hour`. - pub fn with_hour(&mut self, hour: u32) -> &mut Self { - self.hour = hour; - - self - } - - /// Builder method to set the `Minute`. - pub fn with_minute(&mut self, minute: u32) -> &mut Self { - self.minute = minute; - - self - } - - /// Builder method to set the `Second`. - pub fn with_second(&mut self, second: u32) -> &mut Self { - self.second = second; - - self - } - - /// Builder method to set the `Millisecond`. - pub fn with_millisecond(&mut self, millisecond: u32) -> &mut Self { - self.millisecond = millisecond; - - self - } - - /// Converts the `DateTimeBuilder` to a string with a specified format and locale. - fn to_string(self, timezone: Timezone, format: Option, locale: Option) -> String - where - T: ToString, - { - let format_lazy: Lazy = Lazy::new(|| { - if let Some(fmt) = format { - fmt.to_string() - } else { - "%Y-%m-%dT%H:%M:%SZ".to_string() - } - }); - - let locale_lazy: Lazy = Lazy::new(|| { - if let Some(locale) = locale { - locale.to_string() - } else { - "en".to_string() - } - }); - - match timezone { - Timezone::Utc => Utc - .with_ymd_and_hms( - self.year, - self.month, - self.day, - self.hour, - self.minute, - self.second, - ) - .unwrap() - .formatl((*format_lazy).as_str(), (*locale_lazy).as_str()) - .to_string(), - Timezone::Local => Local - .with_ymd_and_hms( - self.year, - self.month, - self.day, - self.hour, - self.minute, - self.second, - ) - .unwrap() - .formatl((*format_lazy).as_str(), (*locale_lazy).as_str()) - .to_string(), - } - } - - fn build(self) -> Self { - self - } -} - -impl LuaUserData for DateTimeBuilder {} - -impl<'lua> FromLua<'lua> for DateTimeBuilder { - fn from_lua(value: LuaValue<'lua>, _: &'lua Lua) -> LuaResult { - match value { - LuaValue::Table(t) => Ok(Self::default() - .with_year(t.get("year")?) - // FIXME: Months are offset by two, months start on march for some reason... - .with_month( - (match t.get("month")? { - LuaValue::String(str) => Ok(str.to_str()?.parse::().or(Err( - LuaError::external("could not cast month string to Month"), - ))?), - LuaValue::Nil => { - Err(LuaError::external("cannot find mandatory month argument")) - } - LuaValue::Number(num) => Ok(Month::try_from(num as u8).or(Err( - LuaError::external("could not cast month number to Month"), - ))?), - LuaValue::Integer(int) => Ok(Month::try_from(int as u8).or(Err( - LuaError::external("could not cast month integer to Month"), - ))?), - _ => Err(LuaError::external("unexpected month field type")), - })?, - ) - .with_day(t.get("day")?) - .with_hour(t.get("hour")?) - .with_minute(t.get("minute")?) - .with_second(t.get("second")?) - // TODO: millisecond support - .build()), - _ => Err(LuaError::external( - "expected type table for DateTimeBuilder", - )), - } - } -} From a7833bbba955512632675e47280021797edc6a85 Mon Sep 17 00:00:00 2001 From: Compey Date: Sun, 27 Aug 2023 12:21:43 +0530 Subject: [PATCH 22/62] fix: fromUnixTimestamp conversion bug --- src/lune/builtins/datetime/mod.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lune/builtins/datetime/mod.rs b/src/lune/builtins/datetime/mod.rs index 6f04f60c..c0a06cbb 100644 --- a/src/lune/builtins/datetime/mod.rs +++ b/src/lune/builtins/datetime/mod.rs @@ -11,6 +11,7 @@ use crate::lune::util::TableBuilder; // TODO: Proper error handling and stuff // FIX: DateTime::from_iso_date is broken +// FIX: fromUnixTimestamp calculation is broken pub fn create(lua: &'static Lua) -> LuaResult { TableBuilder::new(lua)? @@ -23,11 +24,12 @@ pub fn create(lua: &'static Lua) -> LuaResult { TimestampType::Millis => { // FIXME: Remove the unwrap // If something breaks, blame this. - // FIX: Decimal values cause panic, "no such local time". let timestamp = timestamp_cloned.as_f64().unwrap(); - (((timestamp - timestamp.fract()) * 1000_f64) // converting the whole seconds part to millis - + timestamp.fract() * ((10_u64.pow(timestamp.fract().to_string().split('.').collect::>()[1].len() as u32)) as f64)) as i64 + ((((timestamp - timestamp.fract()) as u64) * 1000_u64) // converting the whole seconds part to millis + // the ..3 gets a &str of the first 3 chars of the digits after the decimals, ignoring + // additional floating point accuracy digits + + (timestamp.fract() * (10_u64.pow(timestamp.fract().to_string().split('.').collect::>()[1][..3].len() as u32)) as f64) as u64) as i64 // adding the millis to the fract as a whole number // HACK: 10 * (timestamp.fract().to_string().len() - 2) gives us the number of digits // after the decimal From c46ae61d34f9d9775b6e9923abed533f5f2cb1c7 Mon Sep 17 00:00:00 2001 From: Compey Date: Sun, 27 Aug 2023 12:46:00 +0530 Subject: [PATCH 23/62] feat: include types for @lune/datetime --- types/datetime.luau | 109 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 types/datetime.luau diff --git a/types/datetime.luau b/types/datetime.luau new file mode 100644 index 00000000..1e1756c0 --- /dev/null +++ b/types/datetime.luau @@ -0,0 +1,109 @@ +-- TODO: Add docs + +export type Locale = "en" | "de" | "es" | "fr" | "it" | "ja" | "pl" | "pt-br" | "pt" | "tr" + +export type Timezone = "utc" | "local" + +export type ShortMonth = + "jan" + | "feb" + | "mar" + | "apr" + | "may" + | "jun" + | "jul" + | "aug" + | "sep" + | "oct" + | "nov" + | "dec" + +export type Month = + "january" + | "february" + | "march" + | "april" + | "may" + | "june" + | "july" + | "august" + | "september" + | "october" + | "november" + | "december" + +export type DateTimeValues = { + year: number, + month: number | ShortMonth | Month, + day: number, + hour: number, + minute: number, + second: number, + millisecond: number, +} + +export type DateTime = { + unixTimestamp: number, + unixTimestampMillis: number, + + toIsoDate: (self: DateTime) -> string, + toLocalTime: (self: DateTime) -> DateTimeValues, + toUniversalTime: (self: DateTime) -> DateTimeValues, + formatTime: ( + self: DateTime, + timezone: Timezone, + formatString: string, + locale: Locale + ) -> string, +} + +--[=[ + @class DateTime + + Built-in library for date & time manipulation + + ### Example usage + + ```lua + local DateTime = require("@lune/datetime") + ``` +]=] +local dateTime = {} + +--[=[ + @within DateTime + + Returns a `DateTime` representing the current moment in time. + + @return A DateTime instance +]=] +function dateTime.now(): DateTime + return nil :: any +end + +--[=[ + @within DateTime + + Returns a new `DateTime` object from the given Unix timestamp, or + the number of **seconds** since January 1st, 1970 at 00:00 (UTC). + + @param unixTimestamp The number of seconds or milliseconds (or both) since the Unix epoch. The fraction part of a float denotes the milliseconds. + @return A DateTime instance +]=] +function dateTime.fromUnixTimestamp(unixTimestamp: number?): DateTime + return nil :: any +end + +function dateTime.fromUniversalTime(dateTime: DateTimeValues?): DateTime + return nil :: any +end + +function dateTime.fromLocalTime(dateTime: DateTimeValues?): DateTime + return nil :: any +end + +function dateTime.fromIsoDate(iso_date: string): DateTime? + return nil :: any +end + +return dateTime From 28b16b3e05d3c41e12fa4db8ecaeb7d0b2289b1f Mon Sep 17 00:00:00 2001 From: Compey Date: Sun, 27 Aug 2023 12:46:27 +0530 Subject: [PATCH 24/62] chore(tests): include tests for DateTime library --- src/tests.rs | 10 +++++++++ tests/datetime/formattime.luau | 16 ++++++++++++++ tests/datetime/fromisodate.luau | 13 +++++++++++ tests/datetime/fromlocaltime.luau | 32 +++++++++++++++++++++++++++ tests/datetime/fromuniversaltime.luau | 32 +++++++++++++++++++++++++++ tests/datetime/fromunixtimestamp.luau | 16 ++++++++++++++ tests/datetime/now.luau | 8 +++++++ tests/datetime/toisodate.luau | 9 ++++++++ tests/datetime/tolocaltime.luau | 8 +++++++ tests/datetime/touniversaltime.luau | 8 +++++++ 10 files changed, 152 insertions(+) create mode 100644 tests/datetime/formattime.luau create mode 100644 tests/datetime/fromisodate.luau create mode 100644 tests/datetime/fromlocaltime.luau create mode 100644 tests/datetime/fromuniversaltime.luau create mode 100644 tests/datetime/fromunixtimestamp.luau create mode 100644 tests/datetime/now.luau create mode 100644 tests/datetime/toisodate.luau create mode 100644 tests/datetime/tolocaltime.luau create mode 100644 tests/datetime/touniversaltime.luau diff --git a/src/tests.rs b/src/tests.rs index 0aa89758..8736139d 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -106,6 +106,16 @@ create_tests! { task_delay: "task/delay", task_spawn: "task/spawn", task_wait: "task/wait", + + datetime_now: "datetime/now", + datetime_fromunixtimestamp: "datetime/fromunixtimestamp", + datetime_fromuniversaltime: "datetime/fromuniversaltime", + datetime_touniversaltime: "datetime/touniversaltime", + datetime_fromlocaltime: "datetime/fromlocaltime", + datetime_tolocaltime: "datetime/tolocaltime", + datetime_fromisodate: "datetime/fromisodate", + datetime_toisodate: "datetime/toisodate", + datetime_formattime: "datetime/formattime", } #[cfg(feature = "roblox")] diff --git a/tests/datetime/formattime.luau b/tests/datetime/formattime.luau new file mode 100644 index 00000000..e16238bc --- /dev/null +++ b/tests/datetime/formattime.luau @@ -0,0 +1,16 @@ +local DateTime = require("@lune/datetime") + +-- UTC Timezone +assert( + DateTime.fromUnixTimestamp(1693068988):formatTime("utc", "%Y-%m-%dT%H:%M:%SZ", "en") + == "2023-08-26T16:56:28Z", + "invalid ISO 8601 formatting for DateTime.formatTime()" +) + +assert( + DateTime.fromUnixTimestamp(1693068988):formatTime("utc", "%A, %d %B %Y", "fr") + == "samedi, 26 août 2023", + "expected format specifier '%A, %d %B %Y' to return 'samedi, 26 août 2023' for locale 'fr'" +) + +-- TODO: local timezone tests diff --git a/tests/datetime/fromisodate.luau b/tests/datetime/fromisodate.luau new file mode 100644 index 00000000..f9868278 --- /dev/null +++ b/tests/datetime/fromisodate.luau @@ -0,0 +1,13 @@ +local DateTime = require("@lune/datetime") + +-- Fails due to issue with rust side implementation + +assert( + DateTime.fromIsoDate("2023-08-26T16:56:28Z") ~= nil, + "expected DateTime.fromIsoDate() to return DateTime, got nil" +) + +assert( + DateTime.fromIsoDate("1929-12-05T23:18:23Z") ~= nil, + "expected DateTime.fromIsoDate() to return DateTime, got nil" +) diff --git a/tests/datetime/fromlocaltime.luau b/tests/datetime/fromlocaltime.luau new file mode 100644 index 00000000..cf43df03 --- /dev/null +++ b/tests/datetime/fromlocaltime.luau @@ -0,0 +1,32 @@ +local DateTime = require("@lune/datetime") + +assert( + DateTime.fromLocalTime()["unixTimestamp"] == os.time(), + "expected DateTime.fromLocalTime() with no args to return DateTime at current moment" +) + +assert( + DateTime.fromLocalTime({ + ["year"] = 2023, + ["month"] = "aug", + ["day"] = 26, + ["hour"] = 16, + ["minute"] = 56, + ["second"] = 28, + ["millisecond"] = 0, + })["unixTimestamp"] == 1693049188, + "expected DateTime.fromLocalTime() to return DateTime with timestamp to return 1693049188s" +) + +assert( + DateTime.fromLocalTime({ + ["year"] = 2023, + ["month"] = "aug", + ["day"] = 26, + ["hour"] = 16, + ["minute"] = 56, + ["second"] = 28, + ["millisecond"] = 892, + })["unixTimestampMillis"] == 1693049188000, + "expected DateTime.fromLocalTime() with float millis arg timestamp to return 1693049188000ms" +) diff --git a/tests/datetime/fromuniversaltime.luau b/tests/datetime/fromuniversaltime.luau new file mode 100644 index 00000000..400413cb --- /dev/null +++ b/tests/datetime/fromuniversaltime.luau @@ -0,0 +1,32 @@ +local DateTime = require("@lune/datetime") + +assert( + DateTime.fromUniversalTime()["unixTimestamp"] == os.time(), + "expected DateTime.fromLocalTime() with no args to return DateTime at current moment" +) + +assert( + DateTime.fromUniversalTime({ + ["year"] = 2023, + ["month"] = "aug", + ["day"] = 26, + ["hour"] = 16, + ["minute"] = 56, + ["second"] = 28, + ["millisecond"] = 0, + })["unixTimestamp"] == 1693068988, + "expected DateTime.fromLocalTime() to return DateTime with timestamp to return 1693068988s" +) + +assert( + DateTime.fromUniversalTime({ + ["year"] = 2023, + ["month"] = "aug", + ["day"] = 26, + ["hour"] = 16, + ["minute"] = 56, + ["second"] = 28, + ["millisecond"] = 892, + })["unixTimestampMillis"] == 1693068988000, + "expected DateTime.fromLocalTime() with float millis arg timestamp to return 1693068988000ms" +) diff --git a/tests/datetime/fromunixtimestamp.luau b/tests/datetime/fromunixtimestamp.luau new file mode 100644 index 00000000..1cf1956e --- /dev/null +++ b/tests/datetime/fromunixtimestamp.luau @@ -0,0 +1,16 @@ +local DateTime = require("@lune/datetime") + +-- Bug in rust side implementation for fromUnixTimestamp, calculation for conversion there is wonky, +-- a difference of few millis causes differences as whole seconds for some reason + +assert( + DateTime.fromUnixTimestamp(0000.892)["unixTimestampMillis"] == (0 * 1000) + 892, + "expected DateTime.fromUnixTimestamp() with millis float to return correct millis timestamp" +) + +-- We subtract one due to the floating point accuracy... Need to fix later +assert( + DateTime.fromUnixTimestamp(1693114921.632)["unixTimestampMillis"] + == ((1693114921 * 1000) + 632) - 1, + "expected DateTime.fromUnixTimestamp() with millis and seconds float to return correct millis timestamp" +) diff --git a/tests/datetime/now.luau b/tests/datetime/now.luau new file mode 100644 index 00000000..cc5db396 --- /dev/null +++ b/tests/datetime/now.luau @@ -0,0 +1,8 @@ +local DateTime = require("@lune/datetime") + +local TYPE = "DateTime" + +assert( + typeof(DateTime.now()) == TYPE, + `dateTime.now() should return a {TYPE}, returned {tostring(typeof(DateTime.now()))}` +) diff --git a/tests/datetime/toisodate.luau b/tests/datetime/toisodate.luau new file mode 100644 index 00000000..e553e4c3 --- /dev/null +++ b/tests/datetime/toisodate.luau @@ -0,0 +1,9 @@ +local DateTime = require("@lune/datetime") + +assert( + string.match( + DateTime.now():toIsoDate(), + "(%d%d%d%d)-?(%d?%d?)-?(%d?%d?)T(%d?%d?):(%d?%d?):(%d?%d?)Z$" + ), + "invalid ISO 8601 date returned by dateTime.toIsoDate()" +) diff --git a/tests/datetime/tolocaltime.luau b/tests/datetime/tolocaltime.luau new file mode 100644 index 00000000..3be323a5 --- /dev/null +++ b/tests/datetime/tolocaltime.luau @@ -0,0 +1,8 @@ +local DateTime = require("@lune/datetime") + +local TIME = "2023-08-27T05:54:19Z" +local dateTime = DateTime.fromIsoDate(TIME):toLocalTime() +local expectedDateTimeValues = + table.pack(string.match(TIME, "(%d%d%d%d)-?(%d?%d?)-?(%d?%d?)T(%d?%d?):(%d?%d?):(%d?%d?)Z$")) + +-- TODO: Implement the test diff --git a/tests/datetime/touniversaltime.luau b/tests/datetime/touniversaltime.luau new file mode 100644 index 00000000..3be323a5 --- /dev/null +++ b/tests/datetime/touniversaltime.luau @@ -0,0 +1,8 @@ +local DateTime = require("@lune/datetime") + +local TIME = "2023-08-27T05:54:19Z" +local dateTime = DateTime.fromIsoDate(TIME):toLocalTime() +local expectedDateTimeValues = + table.pack(string.match(TIME, "(%d%d%d%d)-?(%d?%d?)-?(%d?%d?)T(%d?%d?):(%d?%d?):(%d?%d?)Z$")) + +-- TODO: Implement the test From 4768134e6fc5b8953fa2d4c814fa27dba9fa0940 Mon Sep 17 00:00:00 2001 From: Compey Date: Sun, 27 Aug 2023 13:05:44 +0530 Subject: [PATCH 25/62] chore(docs): add more docs for luau typing --- src/lune/builtins/datetime/date_time.rs | 2 +- types/datetime.luau | 73 ++++++++++++++++++++++++- 2 files changed, 73 insertions(+), 2 deletions(-) diff --git a/src/lune/builtins/datetime/date_time.rs b/src/lune/builtins/datetime/date_time.rs index 3e95a253..0428593a 100644 --- a/src/lune/builtins/datetime/date_time.rs +++ b/src/lune/builtins/datetime/date_time.rs @@ -94,7 +94,7 @@ impl DateTime { } } - /// Returns a new `DateTime` using the given units from a UTC time. The + /// Returns a new `DateTime` using the given units from a local time. The /// values accepted are similar to those found in the time value table /// returned by `to_local_time`. /// diff --git a/types/datetime.luau b/types/datetime.luau index 1e1756c0..77336366 100644 --- a/types/datetime.luau +++ b/types/datetime.luau @@ -1,4 +1,4 @@ --- TODO: Add docs +-- TODO: Add more docs export type Locale = "en" | "de" | "es" | "fr" | "it" | "ja" | "pl" | "pt-br" | "pt" | "tr" @@ -49,6 +49,7 @@ export type DateTime = { toIsoDate: (self: DateTime) -> string, toLocalTime: (self: DateTime) -> DateTimeValues, toUniversalTime: (self: DateTime) -> DateTimeValues, + formatTime: ( self: DateTime, timezone: Timezone, @@ -66,6 +67,33 @@ export type DateTime = { ```lua local DateTime = require("@lune/datetime") + + -- Returns the current moment in time as a ISO 8601 string + DateTime.now():toIsoDate() + + -- Returns the current moment in time as per the format template in French + DateTime.now():formatTime("utc", "%A, %d %B %Y", "fr") + + -- Returns a specific moment in time as a DateTime instance + DateTime.fromLocalTime({ + ["year"] = 2023, + ["month"] = "aug", + ["day"] = 26, + ["hour"] = 16, + ["minute"] = 56, + ["second"] = 28, + ["millisecond"] = 892, + }) + + -- Returns the current local time as a DateTime instance + DateTime.fromLocalTime() + + -- Returns a DateTime instance from a given float, where the whole denotes the + -- seconds and the fraction denotes the milliseconds + DateTime.fromUnixTimestamp(871978212313.321) + + -- Returns the current time in terms of UTC + DateTime.now():toUniversalTime() ``` ]=] local dateTime = {} @@ -94,14 +122,57 @@ function dateTime.fromUnixTimestamp(unixTimestamp: number?): DateTime return nil :: any end +--[=[ + @within DateTime + + Returns a new `DateTime` using the given units from a UTC time. The + values accepted are similar to those found in the time value table + returned by `to_universal_time`. + + - Date units (year, month, day) that produce an invalid date will raise an error. For example, January 32nd or February 29th on a non-leap year. + - Time units (hour, minute, second, millisecond) that are outside their normal range are valid. For example, 90 minutes will cause the hour to roll over by 1; -10 seconds will cause the minute value to roll back by 1. + - Non-integer values are rounded down. For example, providing 2.5 hours will be equivalent to providing 2 hours, not 2 hours 30 minutes. + - Omitted values are assumed to be their lowest value in their normal range, except for year which defaults to 1970. + + @param dateTime Optional values for the dateTime instance, defaults to the current time + @return A DateTime instance +]=] function dateTime.fromUniversalTime(dateTime: DateTimeValues?): DateTime return nil :: any end +--[=[ + @within DateTime + + Returns a new `DateTime` using the given units from a local time. The + values accepted are similar to those found in the time value table + returned by `to_local_time`. + + - Date units (year, month, day) that produce an invalid date will raise an error. For example, January 32nd or February 29th on a non-leap year. + - Time units (hour, minute, second, millisecond) that are outside their normal range are valid. For example, 90 minutes will cause the hour to roll over by 1; -10 seconds will cause the minute value to roll back by 1. + - Non-integer values are rounded down. For example, providing 2.5 hours will be equivalent to providing 2 hours, not 2 hours 30 minutes. + - Omitted values are assumed to be their lowest value in their normal range, except for year which defaults to 1970. + + @param dateTime Optional values for the dateTime instance, defaults to the current time + @return A DateTime instance +]=] function dateTime.fromLocalTime(dateTime: DateTimeValues?): DateTime return nil :: any end +--[=[ + @within DateTime + + Returns a `DateTime` from an ISO 8601 date-time string in UTC + time, such as those returned by `to_iso_date`. If the + string parsing fails, the function returns `nil`. + + An example ISO 8601 date-time string would be `2020-01-02T10:30:45Z`, + which represents January 2nd 2020 at 10:30 AM, 45 seconds. + + @param isoDate An ISO 8601 formatted string + @return A DateTime instance +]=] function dateTime.fromIsoDate(iso_date: string): DateTime? return nil :: any end From a78ed4e12279d7e77ae3229662084c42cd3cbf8d Mon Sep 17 00:00:00 2001 From: Compey Date: Mon, 28 Aug 2023 00:35:26 +0530 Subject: [PATCH 26/62] fix: DateTime::from_iso_date DateTimeBuilder.to_string had a faulty template str for the ISO 8601 DateTime parsing. --- src/lune/builtins/datetime/builder.rs | 1 - src/lune/builtins/datetime/date_time.rs | 8 +++++--- src/lune/builtins/datetime/mod.rs | 3 --- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/lune/builtins/datetime/builder.rs b/src/lune/builtins/datetime/builder.rs index 5f963f55..eb62621e 100644 --- a/src/lune/builtins/datetime/builder.rs +++ b/src/lune/builtins/datetime/builder.rs @@ -174,7 +174,6 @@ impl<'lua> FromLua<'lua> for DateTimeBuilder { match value { LuaValue::Table(t) => Ok(Self::default() .with_year(t.get("year")?) - // FIXME: Months are offset by two, months start on march for some reason... .with_month( (match t.get("month")? { LuaValue::String(str) => Ok(str.to_str()?.parse::().or(Err( diff --git a/src/lune/builtins/datetime/date_time.rs b/src/lune/builtins/datetime/date_time.rs index 0428593a..94c09903 100644 --- a/src/lune/builtins/datetime/date_time.rs +++ b/src/lune/builtins/datetime/date_time.rs @@ -142,9 +142,11 @@ impl DateTime { where T: ToString, { - let time = - ChronoDateTime::parse_from_str(iso_date.to_string().as_str(), "%Y-%m-%dT%H:%M:%SZ") - .ok()?; + let time = ChronoDateTime::parse_from_str( + format!("{}{}", iso_date.to_string(), "UTC+0000").as_str(), + "%Y-%m-%dT%H:%M:%SZUTC%z", + ) + .ok()?; Some(Self { unix_timestamp: time.timestamp(), diff --git a/src/lune/builtins/datetime/mod.rs b/src/lune/builtins/datetime/mod.rs index c0a06cbb..1a283783 100644 --- a/src/lune/builtins/datetime/mod.rs +++ b/src/lune/builtins/datetime/mod.rs @@ -10,7 +10,6 @@ use self::{ use crate::lune::util::TableBuilder; // TODO: Proper error handling and stuff -// FIX: DateTime::from_iso_date is broken // FIX: fromUnixTimestamp calculation is broken pub fn create(lua: &'static Lua) -> LuaResult { @@ -104,8 +103,6 @@ impl LuaUserData for DateTime { } fn add_methods<'lua, M: LuaUserDataMethods<'lua, Self>>(methods: &mut M) { - methods.add_method("now", |_, _this, ()| Ok(DateTime::now())); - methods.add_method("toIsoDate", |_, this, ()| Ok(this.to_iso_date())); methods.add_method( From e4a65e301bda39267ff5edb4140810ec733c9670 Mon Sep 17 00:00:00 2001 From: Compey Date: Mon, 28 Aug 2023 15:58:11 +0530 Subject: [PATCH 27/62] feat: proper error handling & error propagation --- src/lune/builtins/datetime/builder.rs | 82 +++---------------- src/lune/builtins/datetime/date_time.rs | 10 +-- src/lune/builtins/datetime/mod.rs | 101 ++++++++++++++++++++---- 3 files changed, 104 insertions(+), 89 deletions(-) diff --git a/src/lune/builtins/datetime/builder.rs b/src/lune/builtins/datetime/builder.rs index eb62621e..8cfc48fd 100644 --- a/src/lune/builtins/datetime/builder.rs +++ b/src/lune/builtins/datetime/builder.rs @@ -1,7 +1,6 @@ use crate::lune::builtins::datetime::date_time::Timezone; use chrono::prelude::*; use chrono_locale::LocaleDate; -use mlua::prelude::*; use once_cell::sync::Lazy; #[derive(Copy, Clone)] @@ -37,31 +36,6 @@ impl Default for DateTimeBuilder { } } -impl<'lua> FromLua<'lua> for Timezone { - fn from_lua(value: LuaValue<'lua>, _: &'lua Lua) -> LuaResult { - fn num_to_enum(num: i32) -> LuaResult { - match num { - 1 => Ok(Timezone::Utc), - 2 => Ok(Timezone::Local), - _ => Err(LuaError::external("Invalid enum member!")), - } - } - - match value { - LuaValue::Integer(num) => num_to_enum(num), - LuaValue::Number(num) => num_to_enum(num as i32), - LuaValue::String(str) => match str.to_str()?.to_lowercase().as_str() { - "utc" => Ok(Timezone::Utc), - "local" => Ok(Timezone::Local), - &_ => Err(LuaError::external("Invalid enum member!")), - }, - _ => Err(LuaError::external( - "Invalid enum type, number or string expected", - )), - } - } -} - impl DateTimeBuilder { /// Builder method to set the `Year`. pub fn with_year(&mut self, year: i32) -> &mut Self { @@ -114,7 +88,12 @@ impl DateTimeBuilder { } /// Converts the `DateTimeBuilder` to a string with a specified format and locale. - pub fn to_string(self, timezone: Timezone, format: Option, locale: Option) -> String + pub fn to_string( + self, + timezone: Timezone, + format: Option, + locale: Option, + ) -> Result where T: ToString, { @@ -134,7 +113,7 @@ impl DateTimeBuilder { } }); - match timezone { + Ok(match timezone { Timezone::Utc => Utc .with_ymd_and_hms( self.year, @@ -144,7 +123,8 @@ impl DateTimeBuilder { self.minute, self.second, ) - .unwrap() + .single() + .ok_or(())? .formatl((*format_lazy).as_str(), (*locale_lazy).as_str()) .to_string(), Timezone::Local => Local @@ -156,50 +136,14 @@ impl DateTimeBuilder { self.minute, self.second, ) - .unwrap() + .single() + .ok_or(())? .formatl((*format_lazy).as_str(), (*locale_lazy).as_str()) .to_string(), - } + }) } - fn build(self) -> Self { + pub fn build(self) -> Self { self } } - -impl LuaUserData for DateTimeBuilder {} - -impl<'lua> FromLua<'lua> for DateTimeBuilder { - fn from_lua(value: LuaValue<'lua>, _: &'lua Lua) -> LuaResult { - match value { - LuaValue::Table(t) => Ok(Self::default() - .with_year(t.get("year")?) - .with_month( - (match t.get("month")? { - LuaValue::String(str) => Ok(str.to_str()?.parse::().or(Err( - LuaError::external("could not cast month string to Month"), - ))?), - LuaValue::Nil => { - Err(LuaError::external("cannot find mandatory month argument")) - } - LuaValue::Number(num) => Ok(Month::try_from(num as u8).or(Err( - LuaError::external("could not cast month number to Month"), - ))?), - LuaValue::Integer(int) => Ok(Month::try_from(int as u8).or(Err( - LuaError::external("could not cast month integer to Month"), - ))?), - _ => Err(LuaError::external("unexpected month field type")), - })?, - ) - .with_day(t.get("day")?) - .with_hour(t.get("hour")?) - .with_minute(t.get("minute")?) - .with_second(t.get("second")?) - // TODO: millisecond support - .build()), - _ => Err(LuaError::external( - "expected type table for DateTimeBuilder", - )), - } - } -} diff --git a/src/lune/builtins/datetime/date_time.rs b/src/lune/builtins/datetime/date_time.rs index 94c09903..13606174 100644 --- a/src/lune/builtins/datetime/date_time.rs +++ b/src/lune/builtins/datetime/date_time.rs @@ -211,10 +211,10 @@ impl DateTime { Self::to_datetime_builder(Utc.timestamp_opt(self.unix_timestamp, 0).unwrap()) } - /// Formats a date as a ISO 8601 date-time string. The value returned by this - /// function could be passed to `from_local_time` to produce the original `DateTime` - /// object. - pub fn to_iso_date(&self) -> String { + /// Formats a date as a ISO 8601 date-time string, returns None if the DateTime object is invalid. + /// The value returned by this function could be passed to `from_local_time` to produce the + /// original `DateTime` object. + pub fn to_iso_date(&self) -> Result { self.to_universal_time() .to_string::<&str>(Timezone::Utc, None, None) } @@ -230,7 +230,7 @@ impl DateTime { /// and a format string. The format string should contain tokens, which will /// replace to certain date/time values described by the `DateTime` object. /// For more details, see the [accepted formatter tokens](https://docs.rs/chrono/latest/chrono/format/strftime/index.html). - pub fn format_time(&self, timezone: Timezone, fmt_str: T, locale: T) -> String + pub fn format_time(&self, timezone: Timezone, fmt_str: T, locale: T) -> Result where T: ToString, { diff --git a/src/lune/builtins/datetime/mod.rs b/src/lune/builtins/datetime/mod.rs index 1a283783..f81fa7d9 100644 --- a/src/lune/builtins/datetime/mod.rs +++ b/src/lune/builtins/datetime/mod.rs @@ -1,3 +1,4 @@ +use chrono::Month; use mlua::prelude::*; pub(crate) mod builder; @@ -10,7 +11,6 @@ use self::{ use crate::lune::util::TableBuilder; // TODO: Proper error handling and stuff -// FIX: fromUnixTimestamp calculation is broken pub fn create(lua: &'static Lua) -> LuaResult { TableBuilder::new(lua)? @@ -19,11 +19,9 @@ pub fn create(lua: &'static Lua) -> LuaResult { let timestamp_cloned = timestamp.clone(); let timestamp_kind = TimestampType::from_lua(timestamp, lua)?; let timestamp = match timestamp_kind { - TimestampType::Seconds => timestamp_cloned.as_i64().unwrap(), + TimestampType::Seconds => timestamp_cloned.as_i64().ok_or(LuaError::external("invalid float integer timestamp supplied"))?, TimestampType::Millis => { - // FIXME: Remove the unwrap - // If something breaks, blame this. - let timestamp = timestamp_cloned.as_f64().unwrap(); + let timestamp = timestamp_cloned.as_f64().ok_or(LuaError::external("invalid float timestamp with millis component supplied"))?; ((((timestamp - timestamp.fract()) as u64) * 1000_u64) // converting the whole seconds part to millis // the ..3 gets a &str of the first 3 chars of the digits after the decimals, ignoring @@ -47,20 +45,25 @@ pub fn create(lua: &'static Lua) -> LuaResult { Ok(DateTime::from_local_time(DateTimeBuilder::from_lua(date_time, lua).ok())) })? .with_function("toLocalTime", |_, this: DateTime| { - Ok(this.to_local_time()) + Ok(DateTime::to_local_time(&this)) })? .with_function("fromIsoDate", |_, iso_date: LuaString| { Ok(DateTime::from_iso_date(iso_date.to_string_lossy())) })? - .with_function("toIsoDate", |_, this| Ok(DateTime::to_iso_date(&this)))? + .with_function("toIsoDate", |_, this| Ok(DateTime::to_iso_date(&this).map_err(|()| LuaError::external( + "failed to parse DateTime object, invalid", + ))))? .with_function( "formatTime", |_, (this, timezone, fmt_str, locale): (DateTime, LuaValue, LuaString, LuaString)| { - Ok(this.format_time( + Ok(DateTime::format_time( + &this, Timezone::from_lua(timezone, lua)?, fmt_str.to_string_lossy(), locale.to_string_lossy(), - )) + ).map_err(|()| LuaError::external( + "failed to parse DateTime object, invalid", + ))) }, )? .build_readonly() @@ -103,16 +106,22 @@ impl LuaUserData for DateTime { } fn add_methods<'lua, M: LuaUserDataMethods<'lua, Self>>(methods: &mut M) { - methods.add_method("toIsoDate", |_, this, ()| Ok(this.to_iso_date())); + methods.add_method("toIsoDate", |_, this, ()| { + Ok(this + .to_iso_date() + .map_err(|()| LuaError::external("failed to parse DateTime object, invalid"))) + }); methods.add_method( "formatTime", |_, this, (timezone, fmt_str, locale): (LuaValue, LuaString, LuaString)| { - Ok(this.format_time( - Timezone::from_lua(timezone, &Lua::new())?, - fmt_str.to_string_lossy(), - locale.to_string_lossy(), - )) + Ok(this + .format_time( + Timezone::from_lua(timezone, &Lua::new())?, + fmt_str.to_string_lossy(), + locale.to_string_lossy(), + ) + .map_err(|()| LuaError::external("failed to parse DateTime object, invalid"))) }, ); @@ -138,3 +147,65 @@ impl<'lua> FromLua<'lua> for DateTime { } } } + +impl LuaUserData for DateTimeBuilder {} + +impl<'lua> FromLua<'lua> for DateTimeBuilder { + fn from_lua(value: LuaValue<'lua>, _: &'lua Lua) -> LuaResult { + match value { + LuaValue::Table(t) => Ok(Self::default() + .with_year(t.get("year")?) + .with_month( + (match t.get("month")? { + LuaValue::String(str) => Ok(str.to_str()?.parse::().or(Err( + LuaError::external("could not cast month string to Month"), + ))?), + LuaValue::Nil => { + Err(LuaError::external("cannot find mandatory month argument")) + } + LuaValue::Number(num) => Ok(Month::try_from(num as u8).or(Err( + LuaError::external("could not cast month number to Month"), + ))?), + LuaValue::Integer(int) => Ok(Month::try_from(int as u8).or(Err( + LuaError::external("could not cast month integer to Month"), + ))?), + _ => Err(LuaError::external("unexpected month field type")), + })?, + ) + .with_day(t.get("day")?) + .with_hour(t.get("hour")?) + .with_minute(t.get("minute")?) + .with_second(t.get("second")?) + // TODO: millisecond support + .build()), + _ => Err(LuaError::external( + "expected type table for DateTimeBuilder", + )), + } + } +} + +impl<'lua> FromLua<'lua> for Timezone { + fn from_lua(value: LuaValue<'lua>, _: &'lua Lua) -> LuaResult { + fn num_to_enum(num: i32) -> LuaResult { + match num { + 1 => Ok(Timezone::Utc), + 2 => Ok(Timezone::Local), + _ => Err(LuaError::external("Invalid enum member!")), + } + } + + match value { + LuaValue::Integer(num) => num_to_enum(num), + LuaValue::Number(num) => num_to_enum(num as i32), + LuaValue::String(str) => match str.to_str()?.to_lowercase().as_str() { + "utc" => Ok(Timezone::Utc), + "local" => Ok(Timezone::Local), + &_ => Err(LuaError::external("Invalid enum member!")), + }, + _ => Err(LuaError::external( + "Invalid enum type, number or string expected", + )), + } + } +} From c3e456f0ef11ed23e22981a28f147123ca58d482 Mon Sep 17 00:00:00 2001 From: Compey Date: Mon, 28 Aug 2023 17:07:49 +0530 Subject: [PATCH 28/62] chore(tests): finalize and implement missing tests --- src/lune/builtins/datetime/mod.rs | 13 ++++++++++++- tests/datetime/fromlocaltime.luau | 6 +++--- tests/datetime/fromuniversaltime.luau | 8 ++++---- tests/datetime/tolocaltime.luau | 26 +++++++++++++++++++++----- tests/datetime/touniversaltime.luau | 26 +++++++++++++++++++++----- 5 files changed, 61 insertions(+), 18 deletions(-) diff --git a/src/lune/builtins/datetime/mod.rs b/src/lune/builtins/datetime/mod.rs index f81fa7d9..320d2394 100644 --- a/src/lune/builtins/datetime/mod.rs +++ b/src/lune/builtins/datetime/mod.rs @@ -148,7 +148,17 @@ impl<'lua> FromLua<'lua> for DateTime { } } -impl LuaUserData for DateTimeBuilder {} +impl LuaUserData for DateTimeBuilder { + fn add_fields<'lua, F: LuaUserDataFields<'lua, Self>>(fields: &mut F) { + fields.add_field_method_get("year", |_, this| Ok(this.year)); + fields.add_field_method_get("month", |_, this| Ok(this.month)); + fields.add_field_method_get("day", |_, this| Ok(this.day)); + fields.add_field_method_get("hour", |_, this| Ok(this.hour)); + fields.add_field_method_get("minute", |_, this| Ok(this.minute)); + fields.add_field_method_get("second", |_, this| Ok(this.second)); + fields.add_field_method_get("millisecond", |_, this| Ok(this.millisecond)); + } +} impl<'lua> FromLua<'lua> for DateTimeBuilder { fn from_lua(value: LuaValue<'lua>, _: &'lua Lua) -> LuaResult { @@ -176,6 +186,7 @@ impl<'lua> FromLua<'lua> for DateTimeBuilder { .with_hour(t.get("hour")?) .with_minute(t.get("minute")?) .with_second(t.get("second")?) + .with_millisecond(t.get("millisecond")?) // TODO: millisecond support .build()), _ => Err(LuaError::external( diff --git a/tests/datetime/fromlocaltime.luau b/tests/datetime/fromlocaltime.luau index cf43df03..0260cfd1 100644 --- a/tests/datetime/fromlocaltime.luau +++ b/tests/datetime/fromlocaltime.luau @@ -15,7 +15,7 @@ assert( ["second"] = 28, ["millisecond"] = 0, })["unixTimestamp"] == 1693049188, - "expected DateTime.fromLocalTime() to return DateTime with timestamp to return 1693049188s" + "expected DateTime.fromLocalTime() with DateTimeValues arg to return 1693049188s" ) assert( @@ -27,6 +27,6 @@ assert( ["minute"] = 56, ["second"] = 28, ["millisecond"] = 892, - })["unixTimestampMillis"] == 1693049188000, - "expected DateTime.fromLocalTime() with float millis arg timestamp to return 1693049188000ms" + })["unixTimestampMillis"] == 1693049188892, + "expected DateTime.fromLocalTime() with DateTimeValues arg with millis to return 1693049188892ms" ) diff --git a/tests/datetime/fromuniversaltime.luau b/tests/datetime/fromuniversaltime.luau index 400413cb..a56f8d45 100644 --- a/tests/datetime/fromuniversaltime.luau +++ b/tests/datetime/fromuniversaltime.luau @@ -2,7 +2,7 @@ local DateTime = require("@lune/datetime") assert( DateTime.fromUniversalTime()["unixTimestamp"] == os.time(), - "expected DateTime.fromLocalTime() with no args to return DateTime at current moment" + "expected DateTime.fromLocalTime() with no args to return DateTime at the current moment" ) assert( @@ -15,7 +15,7 @@ assert( ["second"] = 28, ["millisecond"] = 0, })["unixTimestamp"] == 1693068988, - "expected DateTime.fromLocalTime() to return DateTime with timestamp to return 1693068988s" + "expected DateTime.fromUniversalTime() with DateTimeValues arg to return 1693068988s" ) assert( @@ -27,6 +27,6 @@ assert( ["minute"] = 56, ["second"] = 28, ["millisecond"] = 892, - })["unixTimestampMillis"] == 1693068988000, - "expected DateTime.fromLocalTime() with float millis arg timestamp to return 1693068988000ms" + })["unixTimestampMillis"] == 1693068988892, + "expected DateTime.fromUniversalTime() with DateTimeValues arg with millis to return 1693068988892ms" ) diff --git a/tests/datetime/tolocaltime.luau b/tests/datetime/tolocaltime.luau index 3be323a5..6792db99 100644 --- a/tests/datetime/tolocaltime.luau +++ b/tests/datetime/tolocaltime.luau @@ -1,8 +1,24 @@ local DateTime = require("@lune/datetime") -local TIME = "2023-08-27T05:54:19Z" -local dateTime = DateTime.fromIsoDate(TIME):toLocalTime() -local expectedDateTimeValues = - table.pack(string.match(TIME, "(%d%d%d%d)-?(%d?%d?)-?(%d?%d?)T(%d?%d?):(%d?%d?):(%d?%d?)Z$")) +local dateTime = (DateTime.fromIsoDate("2023-08-27T05:54:19Z") :: DateTime.DateTime):toLocalTime() --- TODO: Implement the test +local expectedDateTimeValues = table.pack( + string.match( + "2023-08-27T11:24:19Z", + "(%d%d%d%d)-?(%d?%d?)-?(%d?%d?)T(%d?%d?):(%d?%d?):(%d?%d?)Z$" + ) +) + +local expectedYear = tonumber(expectedDateTimeValues[1]) +local expectedMonth = tonumber(expectedDateTimeValues[2]) +local expectedDay = tonumber(expectedDateTimeValues[3]) +local expectedHour = tonumber(expectedDateTimeValues[4]) +local expectedMinute = tonumber(expectedDateTimeValues[5]) +local expectedSecond = tonumber(expectedDateTimeValues[6]) + +assert(dateTime.year == expectedYear, `expected {dateTime.year} == {expectedYear}`) +assert(dateTime.month == expectedMonth, `expected {dateTime.month} == {expectedMonth}`) +assert(dateTime.day == expectedDay, `expected {dateTime.day} == {expectedDay}`) +assert(dateTime.hour == expectedHour, `expected {dateTime.hour} == {expectedHour}`) +assert(dateTime.minute == expectedMinute, `expected {dateTime.minute} == {expectedMinute}`) +assert(dateTime.second == expectedSecond, `expected {dateTime.second} == {expectedSecond}`) diff --git a/tests/datetime/touniversaltime.luau b/tests/datetime/touniversaltime.luau index 3be323a5..6792db99 100644 --- a/tests/datetime/touniversaltime.luau +++ b/tests/datetime/touniversaltime.luau @@ -1,8 +1,24 @@ local DateTime = require("@lune/datetime") -local TIME = "2023-08-27T05:54:19Z" -local dateTime = DateTime.fromIsoDate(TIME):toLocalTime() -local expectedDateTimeValues = - table.pack(string.match(TIME, "(%d%d%d%d)-?(%d?%d?)-?(%d?%d?)T(%d?%d?):(%d?%d?):(%d?%d?)Z$")) +local dateTime = (DateTime.fromIsoDate("2023-08-27T05:54:19Z") :: DateTime.DateTime):toLocalTime() --- TODO: Implement the test +local expectedDateTimeValues = table.pack( + string.match( + "2023-08-27T11:24:19Z", + "(%d%d%d%d)-?(%d?%d?)-?(%d?%d?)T(%d?%d?):(%d?%d?):(%d?%d?)Z$" + ) +) + +local expectedYear = tonumber(expectedDateTimeValues[1]) +local expectedMonth = tonumber(expectedDateTimeValues[2]) +local expectedDay = tonumber(expectedDateTimeValues[3]) +local expectedHour = tonumber(expectedDateTimeValues[4]) +local expectedMinute = tonumber(expectedDateTimeValues[5]) +local expectedSecond = tonumber(expectedDateTimeValues[6]) + +assert(dateTime.year == expectedYear, `expected {dateTime.year} == {expectedYear}`) +assert(dateTime.month == expectedMonth, `expected {dateTime.month} == {expectedMonth}`) +assert(dateTime.day == expectedDay, `expected {dateTime.day} == {expectedDay}`) +assert(dateTime.hour == expectedHour, `expected {dateTime.hour} == {expectedHour}`) +assert(dateTime.minute == expectedMinute, `expected {dateTime.minute} == {expectedMinute}`) +assert(dateTime.second == expectedSecond, `expected {dateTime.second} == {expectedSecond}`) From 2b469580078b3873d9d11c0f29042226d1f7acb9 Mon Sep 17 00:00:00 2001 From: Compey Date: Mon, 4 Sep 2023 12:23:18 +0530 Subject: [PATCH 29/62] refactor: implement requested changes --- src/lune/builtins/datetime/builder.rs | 28 +++++++++++---------------- src/lune/builtins/datetime/mod.rs | 18 ++--------------- 2 files changed, 13 insertions(+), 33 deletions(-) diff --git a/src/lune/builtins/datetime/builder.rs b/src/lune/builtins/datetime/builder.rs index 8cfc48fd..6a0a88f3 100644 --- a/src/lune/builtins/datetime/builder.rs +++ b/src/lune/builtins/datetime/builder.rs @@ -97,21 +97,15 @@ impl DateTimeBuilder { where T: ToString, { - let format_lazy: Lazy = Lazy::new(|| { - if let Some(fmt) = format { - fmt.to_string() - } else { - "%Y-%m-%dT%H:%M:%SZ".to_string() - } - }); - - let locale_lazy: Lazy = Lazy::new(|| { - if let Some(locale) = locale { - locale.to_string() - } else { - "en".to_string() - } - }); + let format = match format { + Some(fmt) => fmt.to_string(), + None => "%Y-%m-%dT%H:%M:%SZ".to_string(), + }; + + let locale = match locale { + Some(locale) => locale.to_string(), + None => "en".to_string(), + }; Ok(match timezone { Timezone::Utc => Utc @@ -125,7 +119,7 @@ impl DateTimeBuilder { ) .single() .ok_or(())? - .formatl((*format_lazy).as_str(), (*locale_lazy).as_str()) + .formatl((format).as_str(), locale.as_str()) .to_string(), Timezone::Local => Local .with_ymd_and_hms( @@ -138,7 +132,7 @@ impl DateTimeBuilder { ) .single() .ok_or(())? - .formatl((*format_lazy).as_str(), (*locale_lazy).as_str()) + .formatl((format).as_str(), locale.as_str()) .to_string(), }) } diff --git a/src/lune/builtins/datetime/mod.rs b/src/lune/builtins/datetime/mod.rs index 320d2394..70a4af05 100644 --- a/src/lune/builtins/datetime/mod.rs +++ b/src/lune/builtins/datetime/mod.rs @@ -22,13 +22,12 @@ pub fn create(lua: &'static Lua) -> LuaResult { TimestampType::Seconds => timestamp_cloned.as_i64().ok_or(LuaError::external("invalid float integer timestamp supplied"))?, TimestampType::Millis => { let timestamp = timestamp_cloned.as_f64().ok_or(LuaError::external("invalid float timestamp with millis component supplied"))?; - ((((timestamp - timestamp.fract()) as u64) * 1000_u64) // converting the whole seconds part to millis // the ..3 gets a &str of the first 3 chars of the digits after the decimals, ignoring // additional floating point accuracy digits + (timestamp.fract() * (10_u64.pow(timestamp.fract().to_string().split('.').collect::>()[1][..3].len() as u32)) as f64) as u64) as i64 // adding the millis to the fract as a whole number - // HACK: 10 * (timestamp.fract().to_string().len() - 2) gives us the number of digits + // HACK: 10 ** (timestamp.fract().to_string().len() - 2) gives us the number of digits // after the decimal } }; @@ -187,7 +186,6 @@ impl<'lua> FromLua<'lua> for DateTimeBuilder { .with_minute(t.get("minute")?) .with_second(t.get("second")?) .with_millisecond(t.get("millisecond")?) - // TODO: millisecond support .build()), _ => Err(LuaError::external( "expected type table for DateTimeBuilder", @@ -198,25 +196,13 @@ impl<'lua> FromLua<'lua> for DateTimeBuilder { impl<'lua> FromLua<'lua> for Timezone { fn from_lua(value: LuaValue<'lua>, _: &'lua Lua) -> LuaResult { - fn num_to_enum(num: i32) -> LuaResult { - match num { - 1 => Ok(Timezone::Utc), - 2 => Ok(Timezone::Local), - _ => Err(LuaError::external("Invalid enum member!")), - } - } - match value { - LuaValue::Integer(num) => num_to_enum(num), - LuaValue::Number(num) => num_to_enum(num as i32), LuaValue::String(str) => match str.to_str()?.to_lowercase().as_str() { "utc" => Ok(Timezone::Utc), "local" => Ok(Timezone::Local), &_ => Err(LuaError::external("Invalid enum member!")), }, - _ => Err(LuaError::external( - "Invalid enum type, number or string expected", - )), + _ => Err(LuaError::external("Invalid enum type, string expected")), } } } From 0561b8eea702d8b03e6d5270e4d0fdfe6e4ee955 Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Mon, 4 Sep 2023 12:24:26 +0530 Subject: [PATCH 30/62] refactor: object declaration syntax in test Co-authored-by: Filip Tibell --- types/datetime.luau | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/types/datetime.luau b/types/datetime.luau index 77336366..b6a4f09a 100644 --- a/types/datetime.luau +++ b/types/datetime.luau @@ -76,13 +76,13 @@ export type DateTime = { -- Returns a specific moment in time as a DateTime instance DateTime.fromLocalTime({ - ["year"] = 2023, - ["month"] = "aug", - ["day"] = 26, - ["hour"] = 16, - ["minute"] = 56, - ["second"] = 28, - ["millisecond"] = 892, + year = 2023, + month = "aug", + day = 26, + hour = 16, + minute = 56, + second = 28, + millisecond = 892, }) -- Returns the current local time as a DateTime instance From e161ce3da0b409f3830ed2fcb0be0ad6fce31670 Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Mon, 4 Sep 2023 12:25:16 +0530 Subject: [PATCH 31/62] refactor: remove declaration of self consuming methods in exports Co-authored-by: Filip Tibell --- src/lune/builtins/datetime/mod.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/lune/builtins/datetime/mod.rs b/src/lune/builtins/datetime/mod.rs index 70a4af05..eac0644c 100644 --- a/src/lune/builtins/datetime/mod.rs +++ b/src/lune/builtins/datetime/mod.rs @@ -37,9 +37,6 @@ pub fn create(lua: &'static Lua) -> LuaResult { .with_function("fromUniversalTime", |lua, date_time: LuaValue| { Ok(DateTime::from_universal_time(DateTimeBuilder::from_lua(date_time, lua).ok())) })? - .with_function("toUniversalTime", |_, this: DateTime| { - Ok(this.to_universal_time()) - })? .with_function("fromLocalTime", |lua, date_time: LuaValue| { Ok(DateTime::from_local_time(DateTimeBuilder::from_lua(date_time, lua).ok())) })? From f52aa2d87d4d55d495a76b4993d9118865668c26 Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Mon, 4 Sep 2023 12:26:50 +0530 Subject: [PATCH 32/62] refactor: remove luau setters for fields in DateTime Co-authored-by: Filip Tibell --- src/lune/builtins/datetime/mod.rs | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/lune/builtins/datetime/mod.rs b/src/lune/builtins/datetime/mod.rs index eac0644c..fcaf4ed7 100644 --- a/src/lune/builtins/datetime/mod.rs +++ b/src/lune/builtins/datetime/mod.rs @@ -88,17 +88,6 @@ impl LuaUserData for DateTime { Ok(this.unix_timestamp_millis) }); - fields.add_field_method_set("unixTimestamp", |_, this, val| { - this.unix_timestamp = val; - - Ok(()) - }); - - fields.add_field_method_set("unixTimestampMillis", |_, this, val| { - this.unix_timestamp_millis = val; - - Ok(()) - }); } fn add_methods<'lua, M: LuaUserDataMethods<'lua, Self>>(methods: &mut M) { From 91da9b8f4d272550795f65d32deb4a6a963c83fe Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Mon, 4 Sep 2023 12:28:42 +0530 Subject: [PATCH 33/62] refactor: remove declaration of self consuming methods in exports Co-authored-by: Filip Tibell --- src/lune/builtins/datetime/mod.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/lune/builtins/datetime/mod.rs b/src/lune/builtins/datetime/mod.rs index fcaf4ed7..a2d9ec02 100644 --- a/src/lune/builtins/datetime/mod.rs +++ b/src/lune/builtins/datetime/mod.rs @@ -40,9 +40,6 @@ pub fn create(lua: &'static Lua) -> LuaResult { .with_function("fromLocalTime", |lua, date_time: LuaValue| { Ok(DateTime::from_local_time(DateTimeBuilder::from_lua(date_time, lua).ok())) })? - .with_function("toLocalTime", |_, this: DateTime| { - Ok(DateTime::to_local_time(&this)) - })? .with_function("fromIsoDate", |_, iso_date: LuaString| { Ok(DateTime::from_iso_date(iso_date.to_string_lossy())) })? From a43c32459144735760d8d7b200139a617a86a147 Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Mon, 4 Sep 2023 12:29:06 +0530 Subject: [PATCH 34/62] refactor: remove declaration of self consuming methods in exports Co-authored-by: Filip Tibell --- src/lune/builtins/datetime/mod.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/lune/builtins/datetime/mod.rs b/src/lune/builtins/datetime/mod.rs index a2d9ec02..5e2759ff 100644 --- a/src/lune/builtins/datetime/mod.rs +++ b/src/lune/builtins/datetime/mod.rs @@ -43,9 +43,6 @@ pub fn create(lua: &'static Lua) -> LuaResult { .with_function("fromIsoDate", |_, iso_date: LuaString| { Ok(DateTime::from_iso_date(iso_date.to_string_lossy())) })? - .with_function("toIsoDate", |_, this| Ok(DateTime::to_iso_date(&this).map_err(|()| LuaError::external( - "failed to parse DateTime object, invalid", - ))))? .with_function( "formatTime", |_, (this, timezone, fmt_str, locale): (DateTime, LuaValue, LuaString, LuaString)| { From 1d83af92999bf0773adc4f99eaee5236a839523d Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Mon, 4 Sep 2023 12:29:28 +0530 Subject: [PATCH 35/62] refactor: remove declaration of self consuming methods in exports Co-authored-by: Filip Tibell --- src/lune/builtins/datetime/mod.rs | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/lune/builtins/datetime/mod.rs b/src/lune/builtins/datetime/mod.rs index 5e2759ff..8384f1bd 100644 --- a/src/lune/builtins/datetime/mod.rs +++ b/src/lune/builtins/datetime/mod.rs @@ -43,19 +43,6 @@ pub fn create(lua: &'static Lua) -> LuaResult { .with_function("fromIsoDate", |_, iso_date: LuaString| { Ok(DateTime::from_iso_date(iso_date.to_string_lossy())) })? - .with_function( - "formatTime", - |_, (this, timezone, fmt_str, locale): (DateTime, LuaValue, LuaString, LuaString)| { - Ok(DateTime::format_time( - &this, - Timezone::from_lua(timezone, lua)?, - fmt_str.to_string_lossy(), - locale.to_string_lossy(), - ).map_err(|()| LuaError::external( - "failed to parse DateTime object, invalid", - ))) - }, - )? .build_readonly() } From d9eca85ac24d646c3459075d5537c10e2021550e Mon Sep 17 00:00:00 2001 From: Compey Date: Mon, 4 Sep 2023 12:31:04 +0530 Subject: [PATCH 36/62] refactor: use String instead of LuaString --- src/lune/builtins/datetime/mod.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/lune/builtins/datetime/mod.rs b/src/lune/builtins/datetime/mod.rs index 8384f1bd..9d386ee9 100644 --- a/src/lune/builtins/datetime/mod.rs +++ b/src/lune/builtins/datetime/mod.rs @@ -40,8 +40,8 @@ pub fn create(lua: &'static Lua) -> LuaResult { .with_function("fromLocalTime", |lua, date_time: LuaValue| { Ok(DateTime::from_local_time(DateTimeBuilder::from_lua(date_time, lua).ok())) })? - .with_function("fromIsoDate", |_, iso_date: LuaString| { - Ok(DateTime::from_iso_date(iso_date.to_string_lossy())) + .with_function("fromIsoDate", |_, iso_date: String| { + Ok(DateTime::from_iso_date(iso_date)) })? .build_readonly() } @@ -68,7 +68,6 @@ impl LuaUserData for DateTime { fields.add_field_method_get("unixTimestampMillis", |_, this| { Ok(this.unix_timestamp_millis) }); - } fn add_methods<'lua, M: LuaUserDataMethods<'lua, Self>>(methods: &mut M) { @@ -80,13 +79,9 @@ impl LuaUserData for DateTime { methods.add_method( "formatTime", - |_, this, (timezone, fmt_str, locale): (LuaValue, LuaString, LuaString)| { + |_, this, (timezone, fmt_str, locale): (LuaValue, String, String)| { Ok(this - .format_time( - Timezone::from_lua(timezone, &Lua::new())?, - fmt_str.to_string_lossy(), - locale.to_string_lossy(), - ) + .format_time(Timezone::from_lua(timezone, &Lua::new())?, fmt_str, locale) .map_err(|()| LuaError::external("failed to parse DateTime object, invalid"))) }, ); From e7799cc1c3efc3f2f16b40791076d6cc9c4f0f17 Mon Sep 17 00:00:00 2001 From: Compey Date: Mon, 4 Sep 2023 12:58:30 +0530 Subject: [PATCH 37/62] refactor: proper error handling w/o panics --- src/lune/builtins/datetime/date_time.rs | 85 ++++++++++++++----------- src/lune/builtins/datetime/mod.rs | 18 ++++-- 2 files changed, 59 insertions(+), 44 deletions(-) diff --git a/src/lune/builtins/datetime/date_time.rs b/src/lune/builtins/datetime/date_time.rs index 13606174..7d6bab42 100644 --- a/src/lune/builtins/datetime/date_time.rs +++ b/src/lune/builtins/datetime/date_time.rs @@ -66,31 +66,30 @@ impl DateTime { /// - Time units (hour, minute, second, millisecond) that are outside their normal range are valid. For example, 90 minutes will cause the hour to roll over by 1; -10 seconds will cause the minute value to roll back by 1. /// - Non-integer values are rounded down. For example, providing 2.5 hours will be equivalent to providing 2 hours, not 2 hours 30 minutes. /// - Omitted values are assumed to be their lowest value in their normal range, except for year which defaults to 1970. - pub fn from_universal_time(date_time: Option) -> Self { + pub fn from_universal_time(date_time: Option) -> Result { if let Some(date_time) = date_time { let utc_time: ChronoDateTime = Utc.from_utc_datetime(&NaiveDateTime::new( - NaiveDate::from_ymd_opt(date_time.year, date_time.month, date_time.day) - .expect("invalid date"), + NaiveDate::from_ymd_opt(date_time.year, date_time.month, date_time.day).ok_or(())?, NaiveTime::from_hms_milli_opt( date_time.hour, date_time.minute, date_time.second, date_time.millisecond, ) - .expect("invalid time"), + .ok_or(())?, )); - Self { + Ok(Self { unix_timestamp: utc_time.timestamp(), unix_timestamp_millis: utc_time.timestamp_millis(), - } + }) } else { let utc_time = Utc::now(); - Self { + Ok(Self { unix_timestamp: utc_time.timestamp(), unix_timestamp_millis: utc_time.timestamp_millis(), - } + }) } } @@ -102,33 +101,34 @@ impl DateTime { /// - Time units (hour, minute, second, millisecond) that are outside their normal range are valid. For example, 90 minutes will cause the hour to roll over by 1; -10 seconds will cause the minute value to roll back by 1. /// - Non-integer values are rounded down. For example, providing 2.5 hours will be equivalent to providing 2 hours, not 2 hours 30 minutes. /// - Omitted values are assumed to be their lowest value in their normal range, except for year which defaults to 1970. - pub fn from_local_time(date_time: Option) -> Self { + pub fn from_local_time(date_time: Option) -> Result { if let Some(date_time) = date_time { let local_time: ChronoDateTime = Local .from_local_datetime(&NaiveDateTime::new( NaiveDate::from_ymd_opt(date_time.year, date_time.month, date_time.day) - .expect("invalid date"), + .ok_or(())?, NaiveTime::from_hms_milli_opt( date_time.hour, date_time.minute, date_time.second, date_time.millisecond, ) - .expect("invalid time"), + .ok_or(())?, )) - .unwrap(); + .single() + .ok_or(())?; - Self { + Ok(Self { unix_timestamp: local_time.timestamp(), unix_timestamp_millis: local_time.timestamp_millis(), - } + }) } else { let local_time = Local::now(); - Self { + Ok(Self { unix_timestamp: local_time.timestamp(), unix_timestamp_millis: local_time.timestamp_millis(), - } + }) } } @@ -159,7 +159,7 @@ impl DateTime { /// `Millisecond`. For more details, see the time value table in this data type's /// description. The values within this table could be passed to `from_local_time` /// to produce the original `DateTime` object. - pub fn to_datetime_builder(date_time: ChronoDateTime) -> DateTimeBuilder + pub fn to_datetime_builder(date_time: ChronoDateTime) -> Result where T: TimeZone, { @@ -171,26 +171,26 @@ impl DateTime { date_time_constructor .with_year(date_time.year()) .with_month(match date_time.month() { - 1 => Month::January, - 2 => Month::February, - 3 => Month::March, - 4 => Month::April, - 5 => Month::May, - 6 => Month::June, - 7 => Month::July, - 8 => Month::August, - 9 => Month::September, - 10 => Month::October, - 11 => Month::November, - 12 => Month::December, - _ => panic!("invalid month ordinal"), - }) + 1 => Ok(Month::January), + 2 => Ok(Month::February), + 3 => Ok(Month::March), + 4 => Ok(Month::April), + 5 => Ok(Month::May), + 6 => Ok(Month::June), + 7 => Ok(Month::July), + 8 => Ok(Month::August), + 9 => Ok(Month::September), + 10 => Ok(Month::October), + 11 => Ok(Month::November), + 12 => Ok(Month::December), + _ => Err(()), + }?) .with_day(date_time.day()) .with_hour(date_time.hour()) .with_minute(date_time.minute()) .with_second(date_time.second()); - date_time_constructor + Ok(date_time_constructor) } /// Converts the value of this `DateTime` object to local time. The returned table @@ -198,8 +198,13 @@ impl DateTime { /// `Millisecond`. For more details, see the time value table in this data type's /// description. The values within this table could be passed to `from_local_time` /// to produce the original `DateTime` object. - pub fn to_local_time(&self) -> DateTimeBuilder { - Self::to_datetime_builder(Local.timestamp_opt(self.unix_timestamp, 0).unwrap()) + pub fn to_local_time(&self) -> Result { + Ok(Self::to_datetime_builder( + Local + .timestamp_opt(self.unix_timestamp, 0) + .single() + .ok_or(())?, + )?) } /// Converts the value of this `DateTime` object to Universal Coordinated Time (UTC). @@ -207,15 +212,19 @@ impl DateTime { /// `Minute`, `Second`, `Millisecond`. For more details, see the time value table /// in this data type's description. The values within this table could be passed /// to `from_universal_time` to produce the original `DateTime` object. - pub fn to_universal_time(&self) -> DateTimeBuilder { - Self::to_datetime_builder(Utc.timestamp_opt(self.unix_timestamp, 0).unwrap()) + pub fn to_universal_time(&self) -> Result { + Ok(Self::to_datetime_builder( + Utc.timestamp_opt(self.unix_timestamp, 0) + .single() + .ok_or(())?, + )?) } /// Formats a date as a ISO 8601 date-time string, returns None if the DateTime object is invalid. /// The value returned by this function could be passed to `from_local_time` to produce the /// original `DateTime` object. pub fn to_iso_date(&self) -> Result { - self.to_universal_time() + self.to_universal_time()? .to_string::<&str>(Timezone::Utc, None, None) } @@ -234,7 +243,7 @@ impl DateTime { where T: ToString, { - self.to_universal_time().to_string( + self.to_universal_time()?.to_string( timezone, Some(fmt_str.to_string()), Some(locale.to_string()), diff --git a/src/lune/builtins/datetime/mod.rs b/src/lune/builtins/datetime/mod.rs index 9d386ee9..4b4391ee 100644 --- a/src/lune/builtins/datetime/mod.rs +++ b/src/lune/builtins/datetime/mod.rs @@ -35,10 +35,10 @@ pub fn create(lua: &'static Lua) -> LuaResult { Ok(DateTime::from_unix_timestamp(timestamp_kind, timestamp)) })? .with_function("fromUniversalTime", |lua, date_time: LuaValue| { - Ok(DateTime::from_universal_time(DateTimeBuilder::from_lua(date_time, lua).ok())) + Ok(DateTime::from_universal_time(DateTimeBuilder::from_lua(date_time, lua).ok()).or(Err(LuaError::external("invalid DateTimeValues provided to fromUniversalTime")))) })? .with_function("fromLocalTime", |lua, date_time: LuaValue| { - Ok(DateTime::from_local_time(DateTimeBuilder::from_lua(date_time, lua).ok())) + Ok(DateTime::from_local_time(DateTimeBuilder::from_lua(date_time, lua).ok()).or(Err(LuaError::external("invalid DateTimeValues provided to fromLocalTime")))) })? .with_function("fromIsoDate", |_, iso_date: String| { Ok(DateTime::from_iso_date(iso_date)) @@ -87,11 +87,15 @@ impl LuaUserData for DateTime { ); methods.add_method("toUniversalTime", |_, this: &DateTime, ()| { - Ok(this.to_universal_time()) + Ok(this.to_universal_time().or(Err(LuaError::external( + "invalid DateTime self argument provided to toUniversalTime", + )))) }); methods.add_method("toLocalTime", |_, this: &DateTime, ()| { - Ok(this.to_local_time()) + Ok(this.to_local_time().or(Err(LuaError::external( + "invalid DateTime self argument provided to toLocalTime", + )))) }); } } @@ -99,12 +103,14 @@ impl LuaUserData for DateTime { impl<'lua> FromLua<'lua> for DateTime { fn from_lua(value: LuaValue<'lua>, _: &'lua Lua) -> LuaResult { match value { - LuaValue::Nil => panic!("found nil"), + LuaValue::Nil => Err(LuaError::external( + "expected self of type DateTime, found nil", + )), LuaValue::Table(t) => Ok(DateTime::from_unix_timestamp( TimestampType::Seconds, t.get("unixTimestamp")?, )), - _ => panic!("invalid type"), + _ => Err(LuaError::external("invalid type for DateTime self arg")), } } } From 4f2a008ccd2f735e8000ec2ed4233070d4fbe1fa Mon Sep 17 00:00:00 2001 From: Compey Date: Mon, 4 Sep 2023 13:04:56 +0530 Subject: [PATCH 38/62] fix: remove unused Lazy import --- src/lune/builtins/datetime/builder.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lune/builtins/datetime/builder.rs b/src/lune/builtins/datetime/builder.rs index 6a0a88f3..15165c31 100644 --- a/src/lune/builtins/datetime/builder.rs +++ b/src/lune/builtins/datetime/builder.rs @@ -1,7 +1,6 @@ use crate::lune::builtins::datetime::date_time::Timezone; use chrono::prelude::*; use chrono_locale::LocaleDate; -use once_cell::sync::Lazy; #[derive(Copy, Clone)] pub struct DateTimeBuilder { From f0bbdfdde6024577e6adebaf984d436e48f46e66 Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Mon, 4 Sep 2023 20:16:27 +0530 Subject: [PATCH 39/62] chore: bump chrono to 0.4.28 to possibly fix month enum mapping --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 1aab0777..6b9be314 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -107,7 +107,7 @@ reqwest = { version = "0.11", default-features = false, features = [ tokio-tungstenite = { version = "0.20", features = ["rustls-tls-webpki-roots"] } ### DATETIME -chrono = "0.4.26" +chrono = "0.4.28" chrono_locale = { git = "https://github.com/0x5eal/chrono-locale.git", tag = "v0.1.2" } ### CLI From 72f136f1d39fdc584f0227dc969c6ad03f9764af Mon Sep 17 00:00:00 2001 From: Compey Date: Wed, 6 Sep 2023 13:15:06 +0530 Subject: [PATCH 40/62] chore(crate): use published chrono locale crate --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 6b9be314..216b5b98 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -107,8 +107,8 @@ reqwest = { version = "0.11", default-features = false, features = [ tokio-tungstenite = { version = "0.20", features = ["rustls-tls-webpki-roots"] } ### DATETIME -chrono = "0.4.28" -chrono_locale = { git = "https://github.com/0x5eal/chrono-locale.git", tag = "v0.1.2" } +chrono = "0.4.29" +chrono_lc = "0.1.3" ### CLI From eb642473e368977f5690541067a5004f62809dcc Mon Sep 17 00:00:00 2001 From: Compey Date: Wed, 6 Sep 2023 13:17:36 +0530 Subject: [PATCH 41/62] chore(tests): updated test suite --- Cargo.lock | 6 +- src/lune/builtins/datetime/builder.rs | 93 ++++++++++----- src/lune/builtins/datetime/date_time.rs | 110 ++++++++++-------- src/tests.rs | 16 +-- tests/datetime/formatTime.luau | 41 +++++++ tests/datetime/formattime.luau | 16 --- .../{fromisodate.luau => fromIsoDate.luau} | 2 - tests/datetime/fromLocalTime.luau | 45 +++++++ ...versaltime.luau => fromUniversalTime.luau} | 0 ...xtimestamp.luau => fromUnixTimestamp.luau} | 0 tests/datetime/fromlocaltime.luau | 32 ----- .../{toisodate.luau => toIsoDate.luau} | 0 tests/datetime/toLocalTime.luau | 30 +++++ ...{tolocaltime.luau => toUniversalTime.luau} | 0 tests/datetime/touniversaltime.luau | 24 ---- 15 files changed, 250 insertions(+), 165 deletions(-) create mode 100644 tests/datetime/formatTime.luau delete mode 100644 tests/datetime/formattime.luau rename tests/datetime/{fromisodate.luau => fromIsoDate.luau} (84%) create mode 100644 tests/datetime/fromLocalTime.luau rename tests/datetime/{fromuniversaltime.luau => fromUniversalTime.luau} (100%) rename tests/datetime/{fromunixtimestamp.luau => fromUnixTimestamp.luau} (100%) delete mode 100644 tests/datetime/fromlocaltime.luau rename tests/datetime/{toisodate.luau => toIsoDate.luau} (100%) create mode 100644 tests/datetime/toLocalTime.luau rename tests/datetime/{tolocaltime.luau => toUniversalTime.luau} (100%) delete mode 100644 tests/datetime/touniversaltime.luau diff --git a/Cargo.lock b/Cargo.lock index f5129c7a..5ddb87ec 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -310,9 +310,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.26" +version = "0.4.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" +checksum = "95ed24df0632f708f5f6d8082675bef2596f7084dee3dd55f632290bf35bfe0f" dependencies = [ "android-tzdata", "iana-time-zone", @@ -320,7 +320,7 @@ dependencies = [ "num-traits", "time 0.1.45", "wasm-bindgen", - "winapi", + "windows-targets 0.48.5", ] [[package]] diff --git a/src/lune/builtins/datetime/builder.rs b/src/lune/builtins/datetime/builder.rs index 15165c31..20f7e734 100644 --- a/src/lune/builtins/datetime/builder.rs +++ b/src/lune/builtins/datetime/builder.rs @@ -2,7 +2,7 @@ use crate::lune::builtins::datetime::date_time::Timezone; use chrono::prelude::*; use chrono_locale::LocaleDate; -#[derive(Copy, Clone)] +#[derive(Copy, Clone, Debug)] pub struct DateTimeBuilder { /// The year. In the range 1400 - 9999. pub year: i32, @@ -98,7 +98,7 @@ impl DateTimeBuilder { { let format = match format { Some(fmt) => fmt.to_string(), - None => "%Y-%m-%dT%H:%M:%SZ".to_string(), + None => "%Y-%m-%dT%H:%M:%SZUTC+%z".to_string(), }; let locale = match locale { @@ -106,34 +106,69 @@ impl DateTimeBuilder { None => "en".to_string(), }; + let time = Utc + .with_ymd_and_hms( + self.year, + self.month, + self.day, + self.hour, + self.minute, + self.second, + ) + .single() + .ok_or(())?; + + // dbg!( + // "{}", + // match timezone { + // Timezone::Utc => time.to_rfc3339(), //.formatl((format).as_str(), locale.as_str()), + // Timezone::Local => time.with_timezone(&Local).to_rfc3339(), // .formatl((format).as_str(), locale.as_str()), + // } + // ); + Ok(match timezone { - Timezone::Utc => Utc - .with_ymd_and_hms( - self.year, - self.month, - self.day, - self.hour, - self.minute, - self.second, - ) - .single() - .ok_or(())? - .formatl((format).as_str(), locale.as_str()) - .to_string(), - Timezone::Local => Local - .with_ymd_and_hms( - self.year, - self.month, - self.day, - self.hour, - self.minute, - self.second, - ) - .single() - .ok_or(())? - .formatl((format).as_str(), locale.as_str()) - .to_string(), - }) + Timezone::Utc => time.formatl((format).as_str(), locale.as_str()), + Timezone::Local => time + .with_timezone(&Local) + .formatl((format).as_str(), locale.as_str()), + } + .to_string()) + + // .formatl((format).as_str(), locale.as_str()) + // .to_string()) + + // Ok(match timezone { + // Timezone::Utc => Utc + // .with_ymd_and_hms( + // self.year, + // self.month, + // self.day, + // self.hour, + // self.minute, + // self.second, + // ) + // .single() + // .ok_or(())? + // .with_timezone(&match timezone { + // Timezone::Utc => Utc, + // Timezone::Local => Local + // }) + // .formatl((format).as_str(), locale.as_str()) + // .to_string(), + // Timezone::Local => Local + // .with_ymd_and_hms( + // self.year, + // self.month, + // self.day, + // self.hour, + // self.minute, + // self.second, + // ) + // .single() + // .ok_or(())? + // .formatl((format).as_str(), locale.as_str()) + // .to_string(), + // }) } pub fn build(self) -> Self { diff --git a/src/lune/builtins/datetime/date_time.rs b/src/lune/builtins/datetime/date_time.rs index 7d6bab42..8f7d7adc 100644 --- a/src/lune/builtins/datetime/date_time.rs +++ b/src/lune/builtins/datetime/date_time.rs @@ -9,6 +9,7 @@ pub enum TimestampType { } /// General timezone types accepted by `DateTime` methods. +#[derive(Eq, PartialEq)] pub enum Timezone { Utc, Local, @@ -67,30 +68,28 @@ impl DateTime { /// - Non-integer values are rounded down. For example, providing 2.5 hours will be equivalent to providing 2 hours, not 2 hours 30 minutes. /// - Omitted values are assumed to be their lowest value in their normal range, except for year which defaults to 1970. pub fn from_universal_time(date_time: Option) -> Result { - if let Some(date_time) = date_time { - let utc_time: ChronoDateTime = Utc.from_utc_datetime(&NaiveDateTime::new( - NaiveDate::from_ymd_opt(date_time.year, date_time.month, date_time.day).ok_or(())?, - NaiveTime::from_hms_milli_opt( - date_time.hour, - date_time.minute, - date_time.second, - date_time.millisecond, - ) - .ok_or(())?, - )); + Ok(match date_time { + Some(date_time) => { + let utc_time: ChronoDateTime = Utc.from_utc_datetime(&NaiveDateTime::new( + NaiveDate::from_ymd_opt(date_time.year, date_time.month, date_time.day) + .ok_or(())?, + NaiveTime::from_hms_milli_opt( + date_time.hour, + date_time.minute, + date_time.second, + date_time.millisecond, + ) + .ok_or(())?, + )); - Ok(Self { - unix_timestamp: utc_time.timestamp(), - unix_timestamp_millis: utc_time.timestamp_millis(), - }) - } else { - let utc_time = Utc::now(); + Self { + unix_timestamp: utc_time.timestamp(), + unix_timestamp_millis: utc_time.timestamp_millis(), + } + } - Ok(Self { - unix_timestamp: utc_time.timestamp(), - unix_timestamp_millis: utc_time.timestamp_millis(), - }) - } + None => Self::now(), + }) } /// Returns a new `DateTime` using the given units from a local time. The @@ -102,34 +101,38 @@ impl DateTime { /// - Non-integer values are rounded down. For example, providing 2.5 hours will be equivalent to providing 2 hours, not 2 hours 30 minutes. /// - Omitted values are assumed to be their lowest value in their normal range, except for year which defaults to 1970. pub fn from_local_time(date_time: Option) -> Result { - if let Some(date_time) = date_time { - let local_time: ChronoDateTime = Local - .from_local_datetime(&NaiveDateTime::new( - NaiveDate::from_ymd_opt(date_time.year, date_time.month, date_time.day) + Ok(match date_time { + Some(date_time) => { + let local_time: ChronoDateTime = Local + .from_local_datetime(&NaiveDateTime::new( + NaiveDate::from_ymd_opt(date_time.year, date_time.month, date_time.day) + .ok_or(())?, + NaiveTime::from_hms_milli_opt( + date_time.hour, + date_time.minute, + date_time.second, + date_time.millisecond, + ) .ok_or(())?, - NaiveTime::from_hms_milli_opt( - date_time.hour, - date_time.minute, - date_time.second, - date_time.millisecond, - ) - .ok_or(())?, - )) - .single() - .ok_or(())?; + )) + .single() + .ok_or(())?; - Ok(Self { - unix_timestamp: local_time.timestamp(), - unix_timestamp_millis: local_time.timestamp_millis(), - }) - } else { - let local_time = Local::now(); + Self { + unix_timestamp: local_time.timestamp(), + unix_timestamp_millis: local_time.timestamp_millis(), + } + } - Ok(Self { - unix_timestamp: local_time.timestamp(), - unix_timestamp_millis: local_time.timestamp_millis(), - }) - } + None => { + let local_time = Local::now(); + + Self { + unix_timestamp: local_time.timestamp(), + unix_timestamp_millis: local_time.timestamp_millis(), + } + } + }) } /// Returns a `DateTime` from an ISO 8601 date-time string in UTC @@ -168,6 +171,7 @@ impl DateTime { // Any less tedious way to get Enum member based on index? // I know there's some crates available with derive macros for this, // would it be okay if used some of them? + date_time_constructor .with_year(date_time.year()) .with_month(match date_time.month() { @@ -199,12 +203,12 @@ impl DateTime { /// description. The values within this table could be passed to `from_local_time` /// to produce the original `DateTime` object. pub fn to_local_time(&self) -> Result { - Ok(Self::to_datetime_builder( + Self::to_datetime_builder( Local .timestamp_opt(self.unix_timestamp, 0) .single() .ok_or(())?, - )?) + ) } /// Converts the value of this `DateTime` object to Universal Coordinated Time (UTC). @@ -213,11 +217,15 @@ impl DateTime { /// in this data type's description. The values within this table could be passed /// to `from_universal_time` to produce the original `DateTime` object. pub fn to_universal_time(&self) -> Result { - Ok(Self::to_datetime_builder( + Self::to_datetime_builder( Utc.timestamp_opt(self.unix_timestamp, 0) .single() .ok_or(())?, - )?) + ) + + // dbg!("{:#?}", m?); + + // m } /// Formats a date as a ISO 8601 date-time string, returns None if the DateTime object is invalid. diff --git a/src/tests.rs b/src/tests.rs index 8736139d..ba6e7187 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -108,14 +108,14 @@ create_tests! { task_wait: "task/wait", datetime_now: "datetime/now", - datetime_fromunixtimestamp: "datetime/fromunixtimestamp", - datetime_fromuniversaltime: "datetime/fromuniversaltime", - datetime_touniversaltime: "datetime/touniversaltime", - datetime_fromlocaltime: "datetime/fromlocaltime", - datetime_tolocaltime: "datetime/tolocaltime", - datetime_fromisodate: "datetime/fromisodate", - datetime_toisodate: "datetime/toisodate", - datetime_formattime: "datetime/formattime", + datetime_from_unix_timestamp: "datetime/fromUnixTimestamp", + datetime_from_universal_time: "datetime/fromUniversalTime", + datetime_to_universal_time: "datetime/toUniversalTime", + datetime_from_local_time: "datetime/fromLocalTime", + datetime_to_local_time: "datetime/toLocalTime", + datetime_from_iso_date: "datetime/fromIsoDate", + datetime_to_iso_date: "datetime/toIsoDate", + datetime_format_time: "datetime/formatTime", } #[cfg(feature = "roblox")] diff --git a/tests/datetime/formatTime.luau b/tests/datetime/formatTime.luau new file mode 100644 index 00000000..39afc9ad --- /dev/null +++ b/tests/datetime/formatTime.luau @@ -0,0 +1,41 @@ +local DateTime = require("@lune/datetime") + +-- UTC Timezone +assert( + DateTime.fromUnixTimestamp(1693068988):formatTime("utc", "%Y-%m-%dT%H:%M:%SZ", "en") + == "2023-08-26T16:56:28Z", + "invalid ISO 8601 formatting for DateTime.formatTime() (UTC)" +) + +assert( + DateTime.fromUnixTimestamp(1693068988):formatTime("utc", "%A, %d %B %Y", "fr") + == "samedi, 26 août 2023", + "expected format specifier '%A, %d %B %Y' to return 'samedi, 26 août 2023' for locale 'fr'" +) + +-- FIXME: Local timezone formatTime fails due to a rust side bug + +local expectedTimeString = os.date("%Y-%m-%dT%H:%M:%SZ%z", 1693932753) + +-- NOTE: UTC Timezone conversions work perfectly fine, issue only for local. +-- So far I've made it so that format_time always converts to_universal_time +-- Builder object. Then in to_string, we construct a ChronoDateTime from the values +-- and convert it to the requested timezone. We then format this with our formatter +-- string. + +-- For debugging, try checking what to_universal_time returns, maybe that's where +-- an incorrect DateTimeBuilder is getting returned... If that's the case, that means +-- there probably isn't any issue with to_string at all. + +-- Yes, an invalid DateTimeBuilder is being returned turns out. Still don't know why actually. + +print( + expectedTimeString, + DateTime.fromUnixTimestamp(1693068988):formatTime("local", "%Y-%m-%dT%H:%M:%SZ", "en") +) + +assert( + DateTime.fromUnixTimestamp(1693068988):formatTime("local", "%Y-%m-%dT%H:%M:%SZ", "en") + == expectedTimeString, + "invalid ISO 8601 formatting for DateTime.formatTime() (local)" +) diff --git a/tests/datetime/formattime.luau b/tests/datetime/formattime.luau deleted file mode 100644 index e16238bc..00000000 --- a/tests/datetime/formattime.luau +++ /dev/null @@ -1,16 +0,0 @@ -local DateTime = require("@lune/datetime") - --- UTC Timezone -assert( - DateTime.fromUnixTimestamp(1693068988):formatTime("utc", "%Y-%m-%dT%H:%M:%SZ", "en") - == "2023-08-26T16:56:28Z", - "invalid ISO 8601 formatting for DateTime.formatTime()" -) - -assert( - DateTime.fromUnixTimestamp(1693068988):formatTime("utc", "%A, %d %B %Y", "fr") - == "samedi, 26 août 2023", - "expected format specifier '%A, %d %B %Y' to return 'samedi, 26 août 2023' for locale 'fr'" -) - --- TODO: local timezone tests diff --git a/tests/datetime/fromisodate.luau b/tests/datetime/fromIsoDate.luau similarity index 84% rename from tests/datetime/fromisodate.luau rename to tests/datetime/fromIsoDate.luau index f9868278..618dc4b0 100644 --- a/tests/datetime/fromisodate.luau +++ b/tests/datetime/fromIsoDate.luau @@ -1,7 +1,5 @@ local DateTime = require("@lune/datetime") --- Fails due to issue with rust side implementation - assert( DateTime.fromIsoDate("2023-08-26T16:56:28Z") ~= nil, "expected DateTime.fromIsoDate() to return DateTime, got nil" diff --git a/tests/datetime/fromLocalTime.luau b/tests/datetime/fromLocalTime.luau new file mode 100644 index 00000000..b1b14576 --- /dev/null +++ b/tests/datetime/fromLocalTime.luau @@ -0,0 +1,45 @@ +local DateTime = require("@lune/datetime") +assert( + DateTime.fromLocalTime()["unixTimestamp"] == os.time(), + "expected DateTime.fromLocalTime() with no args to return DateTime at current moment" +) + +local timeValues1 = os.date("*t", 1693049188) + +assert( + DateTime.fromLocalTime({ + ["year"] = timeValues1.year, + ["month"] = timeValues1.month, + ["day"] = timeValues1.day, + ["hour"] = timeValues1.hour, + ["minute"] = timeValues1.min, + ["second"] = timeValues1.sec, + ["millisecond"] = 0, + })["unixTimestamp"] == 1693049188, + "expected DateTime.fromLocalTime() with DateTimeValues arg to return 1693049188s" +) + +print(DateTime.fromLocalTime({ + ["year"] = 2023, + ["month"] = "aug", + ["day"] = 26, + ["hour"] = 16, + ["minute"] = 56, + ["second"] = 28, + ["millisecond"] = 892, +})["unixTimestamp"]) + +local timeValues2 = os.date("*t", 1693049188.892) + +assert( + DateTime.fromLocalTime({ + ["year"] = timeValues2.year, + ["month"] = timeValues2.month, + ["day"] = timeValues2.day, + ["hour"] = timeValues2.hour, + ["minute"] = timeValues2.min, + ["second"] = timeValues2.sec, + ["millisecond"] = 892, + })["unixTimestampMillis"] == 1693049188892, + "expected DateTime.fromLocalTime() with DateTimeValues arg with millis to return 1693049188892ms" +) diff --git a/tests/datetime/fromuniversaltime.luau b/tests/datetime/fromUniversalTime.luau similarity index 100% rename from tests/datetime/fromuniversaltime.luau rename to tests/datetime/fromUniversalTime.luau diff --git a/tests/datetime/fromunixtimestamp.luau b/tests/datetime/fromUnixTimestamp.luau similarity index 100% rename from tests/datetime/fromunixtimestamp.luau rename to tests/datetime/fromUnixTimestamp.luau diff --git a/tests/datetime/fromlocaltime.luau b/tests/datetime/fromlocaltime.luau deleted file mode 100644 index 0260cfd1..00000000 --- a/tests/datetime/fromlocaltime.luau +++ /dev/null @@ -1,32 +0,0 @@ -local DateTime = require("@lune/datetime") - -assert( - DateTime.fromLocalTime()["unixTimestamp"] == os.time(), - "expected DateTime.fromLocalTime() with no args to return DateTime at current moment" -) - -assert( - DateTime.fromLocalTime({ - ["year"] = 2023, - ["month"] = "aug", - ["day"] = 26, - ["hour"] = 16, - ["minute"] = 56, - ["second"] = 28, - ["millisecond"] = 0, - })["unixTimestamp"] == 1693049188, - "expected DateTime.fromLocalTime() with DateTimeValues arg to return 1693049188s" -) - -assert( - DateTime.fromLocalTime({ - ["year"] = 2023, - ["month"] = "aug", - ["day"] = 26, - ["hour"] = 16, - ["minute"] = 56, - ["second"] = 28, - ["millisecond"] = 892, - })["unixTimestampMillis"] == 1693049188892, - "expected DateTime.fromLocalTime() with DateTimeValues arg with millis to return 1693049188892ms" -) diff --git a/tests/datetime/toisodate.luau b/tests/datetime/toIsoDate.luau similarity index 100% rename from tests/datetime/toisodate.luau rename to tests/datetime/toIsoDate.luau diff --git a/tests/datetime/toLocalTime.luau b/tests/datetime/toLocalTime.luau new file mode 100644 index 00000000..98e1e531 --- /dev/null +++ b/tests/datetime/toLocalTime.luau @@ -0,0 +1,30 @@ +local DateTime = require("@lune/datetime") + +local dateTime = (DateTime.fromIsoDate("2023-08-27T05:54:19Z") :: DateTime.DateTime):toLocalTime() + +local expectedDateTimeValues = os.date("*t", 1693115659) + +assert( + dateTime.year == expectedDateTimeValues.year, + `expected {dateTime.year} == {expectedDateTimeValues.year}` +) +assert( + dateTime.month == expectedDateTimeValues.month, + `expected {dateTime.month} == {expectedDateTimeValues.month}` +) +assert( + dateTime.day == expectedDateTimeValues.day, + `expected {dateTime.day} == {expectedDateTimeValues.day}` +) +assert( + dateTime.hour == expectedDateTimeValues.hour, + `expected {dateTime.hour} == {expectedDateTimeValues.hour}` +) +assert( + dateTime.minute == expectedDateTimeValues.min, + `expected {dateTime.minute} == {expectedDateTimeValues.min}` +) +assert( + dateTime.second == expectedDateTimeValues.sec, + `expected {dateTime.second} == {expectedDateTimeValues.sec}` +) diff --git a/tests/datetime/tolocaltime.luau b/tests/datetime/toUniversalTime.luau similarity index 100% rename from tests/datetime/tolocaltime.luau rename to tests/datetime/toUniversalTime.luau diff --git a/tests/datetime/touniversaltime.luau b/tests/datetime/touniversaltime.luau deleted file mode 100644 index 6792db99..00000000 --- a/tests/datetime/touniversaltime.luau +++ /dev/null @@ -1,24 +0,0 @@ -local DateTime = require("@lune/datetime") - -local dateTime = (DateTime.fromIsoDate("2023-08-27T05:54:19Z") :: DateTime.DateTime):toLocalTime() - -local expectedDateTimeValues = table.pack( - string.match( - "2023-08-27T11:24:19Z", - "(%d%d%d%d)-?(%d?%d?)-?(%d?%d?)T(%d?%d?):(%d?%d?):(%d?%d?)Z$" - ) -) - -local expectedYear = tonumber(expectedDateTimeValues[1]) -local expectedMonth = tonumber(expectedDateTimeValues[2]) -local expectedDay = tonumber(expectedDateTimeValues[3]) -local expectedHour = tonumber(expectedDateTimeValues[4]) -local expectedMinute = tonumber(expectedDateTimeValues[5]) -local expectedSecond = tonumber(expectedDateTimeValues[6]) - -assert(dateTime.year == expectedYear, `expected {dateTime.year} == {expectedYear}`) -assert(dateTime.month == expectedMonth, `expected {dateTime.month} == {expectedMonth}`) -assert(dateTime.day == expectedDay, `expected {dateTime.day} == {expectedDay}`) -assert(dateTime.hour == expectedHour, `expected {dateTime.hour} == {expectedHour}`) -assert(dateTime.minute == expectedMinute, `expected {dateTime.minute} == {expectedMinute}`) -assert(dateTime.second == expectedSecond, `expected {dateTime.second} == {expectedSecond}`) From 2ca961544147191d68415da3a3061cdc7476e655 Mon Sep 17 00:00:00 2001 From: Compey Date: Wed, 6 Sep 2023 13:23:40 +0530 Subject: [PATCH 42/62] feat(types): datetime -> DateTime & fix typing --- tests/datetime/formatTime.luau | 2 +- tests/datetime/fromIsoDate.luau | 2 +- tests/datetime/fromLocalTime.luau | 2 +- tests/datetime/fromUniversalTime.luau | 2 +- tests/datetime/fromUnixTimestamp.luau | 2 +- tests/datetime/now.luau | 2 +- tests/datetime/toIsoDate.luau | 2 +- tests/datetime/toLocalTime.luau | 2 +- tests/datetime/toUniversalTime.luau | 2 +- types/{datetime.luau => DateTime.luau} | 6 +++--- 10 files changed, 12 insertions(+), 12 deletions(-) rename types/{datetime.luau => DateTime.luau} (96%) diff --git a/tests/datetime/formatTime.luau b/tests/datetime/formatTime.luau index 39afc9ad..d43c879e 100644 --- a/tests/datetime/formatTime.luau +++ b/tests/datetime/formatTime.luau @@ -1,4 +1,4 @@ -local DateTime = require("@lune/datetime") +local DateTime = require("@lune/DateTime") -- UTC Timezone assert( diff --git a/tests/datetime/fromIsoDate.luau b/tests/datetime/fromIsoDate.luau index 618dc4b0..d06c1442 100644 --- a/tests/datetime/fromIsoDate.luau +++ b/tests/datetime/fromIsoDate.luau @@ -1,4 +1,4 @@ -local DateTime = require("@lune/datetime") +local DateTime = require("@lune/DateTime") assert( DateTime.fromIsoDate("2023-08-26T16:56:28Z") ~= nil, diff --git a/tests/datetime/fromLocalTime.luau b/tests/datetime/fromLocalTime.luau index b1b14576..25218564 100644 --- a/tests/datetime/fromLocalTime.luau +++ b/tests/datetime/fromLocalTime.luau @@ -1,4 +1,4 @@ -local DateTime = require("@lune/datetime") +local DateTime = require("@lune/DateTime") assert( DateTime.fromLocalTime()["unixTimestamp"] == os.time(), "expected DateTime.fromLocalTime() with no args to return DateTime at current moment" diff --git a/tests/datetime/fromUniversalTime.luau b/tests/datetime/fromUniversalTime.luau index a56f8d45..e172e1f9 100644 --- a/tests/datetime/fromUniversalTime.luau +++ b/tests/datetime/fromUniversalTime.luau @@ -1,4 +1,4 @@ -local DateTime = require("@lune/datetime") +local DateTime = require("@lune/DateTime") assert( DateTime.fromUniversalTime()["unixTimestamp"] == os.time(), diff --git a/tests/datetime/fromUnixTimestamp.luau b/tests/datetime/fromUnixTimestamp.luau index 1cf1956e..219105e9 100644 --- a/tests/datetime/fromUnixTimestamp.luau +++ b/tests/datetime/fromUnixTimestamp.luau @@ -1,4 +1,4 @@ -local DateTime = require("@lune/datetime") +local DateTime = require("@lune/DateTime") -- Bug in rust side implementation for fromUnixTimestamp, calculation for conversion there is wonky, -- a difference of few millis causes differences as whole seconds for some reason diff --git a/tests/datetime/now.luau b/tests/datetime/now.luau index cc5db396..1f195a86 100644 --- a/tests/datetime/now.luau +++ b/tests/datetime/now.luau @@ -1,4 +1,4 @@ -local DateTime = require("@lune/datetime") +local DateTime = require("@lune/DateTime") local TYPE = "DateTime" diff --git a/tests/datetime/toIsoDate.luau b/tests/datetime/toIsoDate.luau index e553e4c3..6125c418 100644 --- a/tests/datetime/toIsoDate.luau +++ b/tests/datetime/toIsoDate.luau @@ -1,4 +1,4 @@ -local DateTime = require("@lune/datetime") +local DateTime = require("@lune/DateTime") assert( string.match( diff --git a/tests/datetime/toLocalTime.luau b/tests/datetime/toLocalTime.luau index 98e1e531..9d5e89dd 100644 --- a/tests/datetime/toLocalTime.luau +++ b/tests/datetime/toLocalTime.luau @@ -1,4 +1,4 @@ -local DateTime = require("@lune/datetime") +local DateTime = require("@lune/DateTime") local dateTime = (DateTime.fromIsoDate("2023-08-27T05:54:19Z") :: DateTime.DateTime):toLocalTime() diff --git a/tests/datetime/toUniversalTime.luau b/tests/datetime/toUniversalTime.luau index 6792db99..47e1ebe4 100644 --- a/tests/datetime/toUniversalTime.luau +++ b/tests/datetime/toUniversalTime.luau @@ -1,4 +1,4 @@ -local DateTime = require("@lune/datetime") +local DateTime = require("@lune/DateTime") local dateTime = (DateTime.fromIsoDate("2023-08-27T05:54:19Z") :: DateTime.DateTime):toLocalTime() diff --git a/types/datetime.luau b/types/DateTime.luau similarity index 96% rename from types/datetime.luau rename to types/DateTime.luau index b6a4f09a..2c91c6a3 100644 --- a/types/datetime.luau +++ b/types/DateTime.luau @@ -47,8 +47,8 @@ export type DateTime = { unixTimestampMillis: number, toIsoDate: (self: DateTime) -> string, - toLocalTime: (self: DateTime) -> DateTimeValues, - toUniversalTime: (self: DateTime) -> DateTimeValues, + toLocalTime: (self: DateTime) -> DateTimeValues & { month: number }, + toUniversalTime: (self: DateTime) -> DateTimeValues & { month: number }, formatTime: ( self: DateTime, @@ -66,7 +66,7 @@ export type DateTime = { ### Example usage ```lua - local DateTime = require("@lune/datetime") + local DateTime = require("@lune/DateTime") -- Returns the current moment in time as a ISO 8601 string DateTime.now():toIsoDate() From 87e579ad1a8f223c1e3b47a468ca06d0e18736c7 Mon Sep 17 00:00:00 2001 From: Compey Date: Wed, 6 Sep 2023 13:30:46 +0530 Subject: [PATCH 43/62] feat: make complete switch to published chrono_lc crate --- Cargo.lock | 25 +++++++++++++------------ src/lune/builtins/datetime/builder.rs | 2 +- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5ddb87ec..792d82fb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -310,9 +310,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.28" +version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95ed24df0632f708f5f6d8082675bef2596f7084dee3dd55f632290bf35bfe0f" +checksum = "d87d9d13be47a5b7c3907137f1290b0459a7f80efb26be8c52afb11963bccb02" dependencies = [ "android-tzdata", "iana-time-zone", @@ -324,9 +324,10 @@ dependencies = [ ] [[package]] -name = "chrono_locale" -version = "0.1.2" -source = "git+https://github.com/0x5eal/chrono-locale.git?tag=v0.1.2#b47f2afe0661a6b15ae788af250ea8afa9e33a4d" +name = "chrono_lc" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4556d06f1286632cf49ef465898936b17c1b903e232965f2b52ebbc6bd5390a" dependencies = [ "chrono", "lazy_static", @@ -1106,7 +1107,7 @@ dependencies = [ "async-compression", "async-trait", "chrono", - "chrono_locale", + "chrono_lc", "clap", "console", "dialoguer", @@ -1963,9 +1964,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.186" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f5db24220c009de9bd45e69fb2938f4b6d2df856aa9304ce377b3180f83b7c1" +checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" dependencies = [ "serde_derive", ] @@ -1982,9 +1983,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.186" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ad697f7e0b65af4983a4ce8f56ed5b357e8d3c36651bf6a7e13639c17b8e670" +checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ "proc-macro2", "quote", @@ -2679,9 +2680,9 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "walkdir" -version = "2.3.3" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" +checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" dependencies = [ "same-file", "winapi-util", diff --git a/src/lune/builtins/datetime/builder.rs b/src/lune/builtins/datetime/builder.rs index 20f7e734..7b2c4b8c 100644 --- a/src/lune/builtins/datetime/builder.rs +++ b/src/lune/builtins/datetime/builder.rs @@ -1,6 +1,6 @@ use crate::lune::builtins::datetime::date_time::Timezone; use chrono::prelude::*; -use chrono_locale::LocaleDate; +use chrono_lc::LocaleDate; #[derive(Copy, Clone, Debug)] pub struct DateTimeBuilder { From aa73a4b72e3e340dfc189e4ace797bb6d5297f0e Mon Sep 17 00:00:00 2001 From: Compey Date: Thu, 7 Sep 2023 14:37:46 +0530 Subject: [PATCH 44/62] fix: fromUniversalTime & fromLocalTime --- src/lune/builtins/datetime/builder.rs | 2 +- src/lune/builtins/datetime/mod.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lune/builtins/datetime/builder.rs b/src/lune/builtins/datetime/builder.rs index 7b2c4b8c..8ede8076 100644 --- a/src/lune/builtins/datetime/builder.rs +++ b/src/lune/builtins/datetime/builder.rs @@ -98,7 +98,7 @@ impl DateTimeBuilder { { let format = match format { Some(fmt) => fmt.to_string(), - None => "%Y-%m-%dT%H:%M:%SZUTC+%z".to_string(), + None => "%Y-%m-%dT%H:%M:%SZ".to_string(), }; let locale = match locale { diff --git a/src/lune/builtins/datetime/mod.rs b/src/lune/builtins/datetime/mod.rs index 4b4391ee..14097714 100644 --- a/src/lune/builtins/datetime/mod.rs +++ b/src/lune/builtins/datetime/mod.rs @@ -153,7 +153,7 @@ impl<'lua> FromLua<'lua> for DateTimeBuilder { .with_hour(t.get("hour")?) .with_minute(t.get("minute")?) .with_second(t.get("second")?) - .with_millisecond(t.get("millisecond")?) + .with_millisecond(t.get("millisecond").or(LuaResult::Ok(0))?) .build()), _ => Err(LuaError::external( "expected type table for DateTimeBuilder", From ac948b22d97c7affd1c8b42e98f8f271fda2a651 Mon Sep 17 00:00:00 2001 From: Compey Date: Thu, 7 Sep 2023 15:19:53 +0530 Subject: [PATCH 45/62] chore(tests): remove note comments --- tests/datetime/formatTime.luau | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/tests/datetime/formatTime.luau b/tests/datetime/formatTime.luau index d43c879e..a46bd498 100644 --- a/tests/datetime/formatTime.luau +++ b/tests/datetime/formatTime.luau @@ -13,29 +13,17 @@ assert( "expected format specifier '%A, %d %B %Y' to return 'samedi, 26 août 2023' for locale 'fr'" ) --- FIXME: Local timezone formatTime fails due to a rust side bug - -local expectedTimeString = os.date("%Y-%m-%dT%H:%M:%SZ%z", 1693932753) - --- NOTE: UTC Timezone conversions work perfectly fine, issue only for local. --- So far I've made it so that format_time always converts to_universal_time --- Builder object. Then in to_string, we construct a ChronoDateTime from the values --- and convert it to the requested timezone. We then format this with our formatter --- string. - --- For debugging, try checking what to_universal_time returns, maybe that's where --- an incorrect DateTimeBuilder is getting returned... If that's the case, that means --- there probably isn't any issue with to_string at all. - --- Yes, an invalid DateTimeBuilder is being returned turns out. Still don't know why actually. +local expectedTimeString = os.date("%Y-%m-%dT%H:%M:%SZ", 1694078954) print( expectedTimeString, - DateTime.fromUnixTimestamp(1693068988):formatTime("local", "%Y-%m-%dT%H:%M:%SZ", "en") + DateTime.fromUnixTimestamp(1694078954):formatTime("local", "%Y-%m-%dT%H:%M:%SZ", "en") ) assert( - DateTime.fromUnixTimestamp(1693068988):formatTime("local", "%Y-%m-%dT%H:%M:%SZ", "en") + DateTime.fromUnixTimestamp(1694078954):formatTime("local", "%Y-%m-%dT%H:%M:%SZ", "en") == expectedTimeString, "invalid ISO 8601 formatting for DateTime.formatTime() (local)" ) + +-- TODO: Locale tests, by using os.date() From 6ddaecb0ba2709dec60f7f5836da4612752a3cca Mon Sep 17 00:00:00 2001 From: Compey Date: Thu, 7 Sep 2023 15:37:10 +0530 Subject: [PATCH 46/62] chore(tests): fix toUniversalTime test --- tests/datetime/toUniversalTime.luau | 46 ++++++++++++++++------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/tests/datetime/toUniversalTime.luau b/tests/datetime/toUniversalTime.luau index 47e1ebe4..1fe47a76 100644 --- a/tests/datetime/toUniversalTime.luau +++ b/tests/datetime/toUniversalTime.luau @@ -1,24 +1,30 @@ local DateTime = require("@lune/DateTime") -local dateTime = (DateTime.fromIsoDate("2023-08-27T05:54:19Z") :: DateTime.DateTime):toLocalTime() +local dateTime = DateTime.fromUnixTimestamp(1693115659):toLocalTime() -local expectedDateTimeValues = table.pack( - string.match( - "2023-08-27T11:24:19Z", - "(%d%d%d%d)-?(%d?%d?)-?(%d?%d?)T(%d?%d?):(%d?%d?):(%d?%d?)Z$" - ) -) - -local expectedYear = tonumber(expectedDateTimeValues[1]) -local expectedMonth = tonumber(expectedDateTimeValues[2]) -local expectedDay = tonumber(expectedDateTimeValues[3]) -local expectedHour = tonumber(expectedDateTimeValues[4]) -local expectedMinute = tonumber(expectedDateTimeValues[5]) -local expectedSecond = tonumber(expectedDateTimeValues[6]) +local expectedDateTimeValues = os.date("*t", 1693115659) -assert(dateTime.year == expectedYear, `expected {dateTime.year} == {expectedYear}`) -assert(dateTime.month == expectedMonth, `expected {dateTime.month} == {expectedMonth}`) -assert(dateTime.day == expectedDay, `expected {dateTime.day} == {expectedDay}`) -assert(dateTime.hour == expectedHour, `expected {dateTime.hour} == {expectedHour}`) -assert(dateTime.minute == expectedMinute, `expected {dateTime.minute} == {expectedMinute}`) -assert(dateTime.second == expectedSecond, `expected {dateTime.second} == {expectedSecond}`) +assert( + dateTime.year == expectedDateTimeValues.year, + `expected {dateTime.year} == {expectedDateTimeValues.year}` +) +assert( + dateTime.month == expectedDateTimeValues.month, + `expected {dateTime.month} == {expectedDateTimeValues.month}` +) +assert( + dateTime.day == expectedDateTimeValues.day, + `expected {dateTime.day} == {expectedDateTimeValues.day}` +) +assert( + dateTime.hour == expectedDateTimeValues.hour, + `expected {dateTime.hour} == {expectedDateTimeValues.hour}` +) +assert( + dateTime.minute == expectedDateTimeValues.min, + `expected {dateTime.minute} == {expectedDateTimeValues.min}` +) +assert( + dateTime.second == expectedDateTimeValues.sec, + `expected {dateTime.second} == {expectedDateTimeValues.sec}` +) From 37c8a6f9cee8a9b95dfbdde9de821a53504c2e1b Mon Sep 17 00:00:00 2001 From: Compey Date: Thu, 7 Sep 2023 15:40:29 +0530 Subject: [PATCH 47/62] chore(tests): use fromIsoDate in toUniversalTime test --- tests/datetime/toUniversalTime.luau | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/datetime/toUniversalTime.luau b/tests/datetime/toUniversalTime.luau index 1fe47a76..9d5e89dd 100644 --- a/tests/datetime/toUniversalTime.luau +++ b/tests/datetime/toUniversalTime.luau @@ -1,6 +1,6 @@ local DateTime = require("@lune/DateTime") -local dateTime = DateTime.fromUnixTimestamp(1693115659):toLocalTime() +local dateTime = (DateTime.fromIsoDate("2023-08-27T05:54:19Z") :: DateTime.DateTime):toLocalTime() local expectedDateTimeValues = os.date("*t", 1693115659) From 829494e30463a025aaf969d59643852b936e4e8c Mon Sep 17 00:00:00 2001 From: Compey Date: Thu, 7 Sep 2023 19:39:14 +0530 Subject: [PATCH 48/62] feat: finalized docs, lmk if i missed something --- src/lune/builtins/datetime/date_time.rs | 2 +- types/DateTime.luau | 76 ++++++++++++++++++++----- 2 files changed, 63 insertions(+), 15 deletions(-) diff --git a/src/lune/builtins/datetime/date_time.rs b/src/lune/builtins/datetime/date_time.rs index 8f7d7adc..4ecda567 100644 --- a/src/lune/builtins/datetime/date_time.rs +++ b/src/lune/builtins/datetime/date_time.rs @@ -243,7 +243,7 @@ impl DateTime { // TODO: Implement more locales for chrono-locale. - /// Generates a string from the `DateTime` value interpreted as **local time** + /// Generates a string from the `DateTime` value interpreted as the specified timezone /// and a format string. The format string should contain tokens, which will /// replace to certain date/time values described by the `DateTime` object. /// For more details, see the [accepted formatter tokens](https://docs.rs/chrono/latest/chrono/format/strftime/index.html). diff --git a/types/DateTime.luau b/types/DateTime.luau index 2c91c6a3..b50e9ef5 100644 --- a/types/DateTime.luau +++ b/types/DateTime.luau @@ -45,17 +45,6 @@ export type DateTimeValues = { export type DateTime = { unixTimestamp: number, unixTimestampMillis: number, - - toIsoDate: (self: DateTime) -> string, - toLocalTime: (self: DateTime) -> DateTimeValues & { month: number }, - toUniversalTime: (self: DateTime) -> DateTimeValues & { month: number }, - - formatTime: ( - self: DateTime, - timezone: Timezone, - formatString: string, - locale: Locale - ) -> string, } --[=[ @@ -127,7 +116,7 @@ end Returns a new `DateTime` using the given units from a UTC time. The values accepted are similar to those found in the time value table - returned by `to_universal_time`. + returned by `toUniversalTime`. - Date units (year, month, day) that produce an invalid date will raise an error. For example, January 32nd or February 29th on a non-leap year. - Time units (hour, minute, second, millisecond) that are outside their normal range are valid. For example, 90 minutes will cause the hour to roll over by 1; -10 seconds will cause the minute value to roll back by 1. @@ -146,7 +135,7 @@ end Returns a new `DateTime` using the given units from a local time. The values accepted are similar to those found in the time value table - returned by `to_local_time`. + returned by `toLocalTime`. - Date units (year, month, day) that produce an invalid date will raise an error. For example, January 32nd or February 29th on a non-leap year. - Time units (hour, minute, second, millisecond) that are outside their normal range are valid. For example, 90 minutes will cause the hour to roll over by 1; -10 seconds will cause the minute value to roll back by 1. @@ -164,7 +153,7 @@ end @within DateTime Returns a `DateTime` from an ISO 8601 date-time string in UTC - time, such as those returned by `to_iso_date`. If the + time, such as those returned by `toIsoDate`. If the string parsing fails, the function returns `nil`. An example ISO 8601 date-time string would be `2020-01-02T10:30:45Z`, @@ -177,4 +166,63 @@ function dateTime.fromIsoDate(iso_date: string): DateTime? return nil :: any end +--[=[ + @within DateTime + + Formats a date as a ISO 8601 date-time string, returns None if the DateTime + object is invalid. The value returned by this function could be passed to + `fromLocalTime` to produce the original `DateTime` object. + + @return ISO 8601 formatted string +]=] +function dateTime:toIsoDate(): string + return nil :: any +end + +--[=[ + @within DateTime + + Converts the value of this `DateTime` object to local time. The returned table + contains the following keys: `Year`, `Month`, `Day`, `Hour`, `Minute`, `Second`, + `Millisecond`. For more details, see the time value table in this data type's + description. The values within this table could be passed to `fromLocalTime` + to produce the original `DateTime` object. + + @return A table of DateTime values +]=] +function dateTime:toLocalTime(): DateTimeValues & { month: number } + return nil :: any +end + +--[=[ + @within DateTime + + Converts the value of this `DateTime` object to universal time. The returned table + contains the following keys: `Year`, `Month`, `Day`, `Hour`, `Minute`, `Second`, + `Millisecond`. For more details, see the time value table in this data type's + description. The values within this table could be passed to `fromUniversalTime` + to produce the original `DateTime` object. + + @return A table of DateTime values +]=] +function dateTime:toUniversalTime(): DateTimeValues & { month: number } + return nil :: any +end + +--[=[ + @within DateTime + + Generates a string from the `DateTime` value interpreted as the specified timezone + and a format string. The format string should contain tokens, which will + replace to certain date/time values described by the `DateTime` object. + + @param timezone The timezone the formatted time string should follow + @param formatString A format string of strfttime items. See [chrono docs](https://docs.rs/chrono/latest/chrono/format/strftime/index.html). + @param locale The locale the time should be formatted in + @return A table of DateTime values +]=] +function dateTime:formatTime(timezone: Timezone, formatString: string, locale: Locale): string + return nil :: any +end + return dateTime From a5efedcaad215409bc641bada49e11cb3d01142d Mon Sep 17 00:00:00 2001 From: Compey Date: Fri, 8 Sep 2023 01:00:12 +0530 Subject: [PATCH 49/62] chore(tests): include local formatTime test with custom locale --- tests/datetime/formatTime.luau | 31 +++++++++++++++++++++++++++---- types/DateTime.luau | 22 +++++++++++----------- 2 files changed, 38 insertions(+), 15 deletions(-) diff --git a/tests/datetime/formatTime.luau b/tests/datetime/formatTime.luau index a46bd498..dc23a82a 100644 --- a/tests/datetime/formatTime.luau +++ b/tests/datetime/formatTime.luau @@ -1,4 +1,5 @@ local DateTime = require("@lune/DateTime") +local process = require("@lune/Process") -- UTC Timezone assert( @@ -10,20 +11,42 @@ assert( assert( DateTime.fromUnixTimestamp(1693068988):formatTime("utc", "%A, %d %B %Y", "fr") == "samedi, 26 août 2023", - "expected format specifier '%A, %d %B %Y' to return 'samedi, 26 août 2023' for locale 'fr'" + "expected format specifier '%A, %d %B %Y' to return 'samedi, 26 août 2023' for locale 'fr' (UTC)" ) local expectedTimeString = os.date("%Y-%m-%dT%H:%M:%SZ", 1694078954) -print( - expectedTimeString, +assert( DateTime.fromUnixTimestamp(1694078954):formatTime("local", "%Y-%m-%dT%H:%M:%SZ", "en") + == expectedTimeString, + "invalid ISO 8601 formatting for DateTime.formatTime() (local)" ) +-- This test requires 'fr_FR.UTF-8 UTF-8' to be in /etc/locale.gen to pass +-- Local Timezone + assert( DateTime.fromUnixTimestamp(1694078954):formatTime("local", "%Y-%m-%dT%H:%M:%SZ", "en") == expectedTimeString, "invalid ISO 8601 formatting for DateTime.formatTime() (local)" ) --- TODO: Locale tests, by using os.date() +local expectedLocalizedString + +local dateCmd = process.spawn("bash", { "-c", "date +\"%A, %d %B %Y\" --date='@1693068988'" }, { + env = { + LC_ALL = "fr_FR.UTF-8 ", + }, +}) + +if dateCmd.ok then + expectedLocalizedString = dateCmd.stdout +else + error("Failed to execute date command") +end + +assert( + DateTime.fromUnixTimestamp(1693068988):formatTime("local", "%A, %d %B %Y", "fr") + == expectedLocalizedString:gsub("\n", ""), + "expected format specifier '%A, %d %B %Y' to return 'samedi, 26 août 2023' for locale 'fr' (local)" +) diff --git a/types/DateTime.luau b/types/DateTime.luau index b50e9ef5..2ad6f44d 100644 --- a/types/DateTime.luau +++ b/types/DateTime.luau @@ -42,11 +42,6 @@ export type DateTimeValues = { millisecond: number, } -export type DateTime = { - unixTimestamp: number, - unixTimestampMillis: number, -} - --[=[ @class DateTime @@ -85,7 +80,10 @@ export type DateTime = { DateTime.now():toUniversalTime() ``` ]=] -local dateTime = {} +local dateTime = { + unixTimestamp = 0, + unixTimestampMillis = 0, +} --[=[ @within DateTime @@ -94,7 +92,7 @@ local dateTime = {} @return A DateTime instance ]=] -function dateTime.now(): DateTime +function dateTime.now(): typeof(dateTime) return nil :: any end @@ -107,7 +105,7 @@ end @param unixTimestamp The number of seconds or milliseconds (or both) since the Unix epoch. The fraction part of a float denotes the milliseconds. @return A DateTime instance ]=] -function dateTime.fromUnixTimestamp(unixTimestamp: number?): DateTime +function dateTime.fromUnixTimestamp(unixTimestamp: number?): typeof(dateTime) return nil :: any end @@ -126,7 +124,7 @@ end @param dateTime Optional values for the dateTime instance, defaults to the current time @return A DateTime instance ]=] -function dateTime.fromUniversalTime(dateTime: DateTimeValues?): DateTime +function dateTime.fromUniversalTime(dateTime: DateTimeValues?): typeof(dateTime) return nil :: any end @@ -145,7 +143,7 @@ end @param dateTime Optional values for the dateTime instance, defaults to the current time @return A DateTime instance ]=] -function dateTime.fromLocalTime(dateTime: DateTimeValues?): DateTime +function dateTime.fromLocalTime(dateTime: DateTimeValues?): typeof(dateTime) return nil :: any end @@ -162,7 +160,7 @@ end @param isoDate An ISO 8601 formatted string @return A DateTime instance ]=] -function dateTime.fromIsoDate(iso_date: string): DateTime? +function dateTime.fromIsoDate(iso_date: string): typeof(dateTime)? return nil :: any end @@ -225,4 +223,6 @@ function dateTime:formatTime(timezone: Timezone, formatString: string, locale: L return nil :: any end +export type DateTime = typeof(dateTime) + return dateTime From 36f2c6e0f6b901b8f7490468b257ec48682486ba Mon Sep 17 00:00:00 2001 From: Compey Date: Fri, 8 Sep 2023 01:24:13 +0530 Subject: [PATCH 50/62] chore(tests): local formatTime locale test better assert error --- tests/datetime/formatTime.luau | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/datetime/formatTime.luau b/tests/datetime/formatTime.luau index dc23a82a..7f588e45 100644 --- a/tests/datetime/formatTime.luau +++ b/tests/datetime/formatTime.luau @@ -40,13 +40,13 @@ local dateCmd = process.spawn("bash", { "-c", "date +\"%A, %d %B %Y\" --date='@1 }) if dateCmd.ok then - expectedLocalizedString = dateCmd.stdout + expectedLocalizedString = dateCmd.stdout:gsub("\n", "") else error("Failed to execute date command") end assert( DateTime.fromUnixTimestamp(1693068988):formatTime("local", "%A, %d %B %Y", "fr") - == expectedLocalizedString:gsub("\n", ""), - "expected format specifier '%A, %d %B %Y' to return 'samedi, 26 août 2023' for locale 'fr' (local)" + == expectedLocalizedString, + `expected format specifier '%A, %d %B %Y' to return '{expectedLocalizedString}' for locale 'fr' (local)` ) From be6b3f46fb95440d615bcc7574f8384259f70820 Mon Sep 17 00:00:00 2001 From: Compey Date: Fri, 8 Sep 2023 12:17:11 +0530 Subject: [PATCH 51/62] chore(tests): fix failing test by writing to locale.gen and generating locales --- src/tests.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/tests.rs b/src/tests.rs index ba6e7187..8a1a2384 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -1,9 +1,9 @@ -use std::process::ExitCode; +use std::process::{ExitCode, Stdio}; use anyhow::Result; use console::set_colors_enabled; use console::set_colors_enabled_stderr; -use tokio::fs::read_to_string; +use tokio::{fs::read_to_string, process::Command}; use crate::Lune; @@ -13,6 +13,20 @@ macro_rules! create_tests { ($($name:ident: $value:expr,)*) => { $( #[tokio::test(flavor = "multi_thread")] async fn $name() -> Result { + // For the formatTime test, we need to enable the fr_FR locale for UTF-8 for the test to pass + if stringify!($name) == "datetime_format_time" { + // Inherits the credentials from parent stdin + let out = Command::new("sudo").arg("-S").arg("echo 'fr_FR.UTF-8 UTF-8' >> /etc/locale.gen").stdin(Stdio::inherit()).output().await?; + + if !out.status.success() { + eprintln!("ERROR: Failed to write locale info to /etc/locale.gen, could not run as root"); + return Ok(ExitCode::FAILURE); + } else { + if !Command::new("sudo").arg("locale-gen").output().await?.status.success() { + return Ok(ExitCode::FAILURE); + } + } + } // Disable styling for stdout and stderr since // some tests rely on output not being styled set_colors_enabled(false); From ee51f187b37ae30a7bcd499359e7ac038ed8e03a Mon Sep 17 00:00:00 2001 From: Compey Date: Fri, 8 Sep 2023 13:26:07 +0530 Subject: [PATCH 52/62] feat(tests): fix superuser command syntax --- src/tests.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tests.rs b/src/tests.rs index 8a1a2384..c0a4982c 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -16,10 +16,11 @@ macro_rules! create_tests { // For the formatTime test, we need to enable the fr_FR locale for UTF-8 for the test to pass if stringify!($name) == "datetime_format_time" { // Inherits the credentials from parent stdin - let out = Command::new("sudo").arg("-S").arg("echo 'fr_FR.UTF-8 UTF-8' >> /etc/locale.gen").stdin(Stdio::inherit()).output().await?; + let out = Command::new("sudo").arg("-S").arg("bash").arg("-c").arg("echo").arg("'fr_FR.UTF-8 UTF-8' >> /etc/locale.gen\"").stdin(Stdio::inherit()).output().await?; if !out.status.success() { eprintln!("ERROR: Failed to write locale info to /etc/locale.gen, could not run as root"); + eprintln!("{}", String::from_utf8_lossy(&out.stderr)); return Ok(ExitCode::FAILURE); } else { if !Command::new("sudo").arg("locale-gen").output().await?.status.success() { From 3570e8c855780b0621734ffe1ba9e3fe25820bb4 Mon Sep 17 00:00:00 2001 From: Compey Date: Fri, 8 Sep 2023 20:49:29 +0530 Subject: [PATCH 53/62] fix(tests): logic for adding custom locale --- src/tests.rs | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/src/tests.rs b/src/tests.rs index c0a4982c..857fb8c1 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -3,7 +3,11 @@ use std::process::{ExitCode, Stdio}; use anyhow::Result; use console::set_colors_enabled; use console::set_colors_enabled_stderr; -use tokio::{fs::read_to_string, process::Command}; +use tokio::{ + fs::{read_to_string, File}, + io::AsyncWriteExt, + process::Command, +}; use crate::Lune; @@ -15,17 +19,31 @@ macro_rules! create_tests { async fn $name() -> Result { // For the formatTime test, we need to enable the fr_FR locale for UTF-8 for the test to pass if stringify!($name) == "datetime_format_time" { + // Create a new scope, so the file gets closed after it is out of scope + { + // Creates a bash script for appending to /etc/locales.gen + + // Using a bash script simplifies a lot of piping logic that would + // otherwise be required in Rust + let mut append_locale_script = File::options().write(true).create(true).mode(0o110).open("target/datetime_format_time_locales.sh").await?; + append_locale_script.write_all(b"echo fr_FR.UTF-8 UTF-8 | tee -a /etc/locale.gen").await?; + }; + // Inherits the credentials from parent stdin - let out = Command::new("sudo").arg("-S").arg("bash").arg("-c").arg("echo").arg("'fr_FR.UTF-8 UTF-8' >> /etc/locale.gen\"").stdin(Stdio::inherit()).output().await?; + let out = Command::new("sudo").arg("-S").arg("bash").arg("-c").arg("target/datetime_format_time_locales.sh").stdin(Stdio::inherit()).output().await?; if !out.status.success() { eprintln!("ERROR: Failed to write locale info to /etc/locale.gen, could not run as root"); eprintln!("{}", String::from_utf8_lossy(&out.stderr)); return Ok(ExitCode::FAILURE); - } else { - if !Command::new("sudo").arg("locale-gen").output().await?.status.success() { - return Ok(ExitCode::FAILURE); - } + } + + let locale_gen = Command::new("sudo").arg("-S").arg("locale-gen").stdin(Stdio::inherit()).output().await?; + + if !locale_gen.status.success() { + eprintln!("ERROR: Failed to run locale-gen as root"); + eprintln!("{}", String::from_utf8_lossy(&out.stderr)); + return Ok(ExitCode::FAILURE); } } // Disable styling for stdout and stderr since From e1dbce64d12bcb3fc7c9c03dd9184c3201b30793 Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Sun, 10 Sep 2023 15:28:31 +0530 Subject: [PATCH 54/62] feat(tests): remove test case setup for formatTime --- src/tests.rs | 37 ++----------------------------------- 1 file changed, 2 insertions(+), 35 deletions(-) diff --git a/src/tests.rs b/src/tests.rs index 857fb8c1..b875b098 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -1,13 +1,9 @@ -use std::process::{ExitCode, Stdio}; +use std::process::Stdio; use anyhow::Result; use console::set_colors_enabled; use console::set_colors_enabled_stderr; -use tokio::{ - fs::{read_to_string, File}, - io::AsyncWriteExt, - process::Command, -}; +use tokio::fs::read_to_string; use crate::Lune; @@ -17,35 +13,6 @@ macro_rules! create_tests { ($($name:ident: $value:expr,)*) => { $( #[tokio::test(flavor = "multi_thread")] async fn $name() -> Result { - // For the formatTime test, we need to enable the fr_FR locale for UTF-8 for the test to pass - if stringify!($name) == "datetime_format_time" { - // Create a new scope, so the file gets closed after it is out of scope - { - // Creates a bash script for appending to /etc/locales.gen - - // Using a bash script simplifies a lot of piping logic that would - // otherwise be required in Rust - let mut append_locale_script = File::options().write(true).create(true).mode(0o110).open("target/datetime_format_time_locales.sh").await?; - append_locale_script.write_all(b"echo fr_FR.UTF-8 UTF-8 | tee -a /etc/locale.gen").await?; - }; - - // Inherits the credentials from parent stdin - let out = Command::new("sudo").arg("-S").arg("bash").arg("-c").arg("target/datetime_format_time_locales.sh").stdin(Stdio::inherit()).output().await?; - - if !out.status.success() { - eprintln!("ERROR: Failed to write locale info to /etc/locale.gen, could not run as root"); - eprintln!("{}", String::from_utf8_lossy(&out.stderr)); - return Ok(ExitCode::FAILURE); - } - - let locale_gen = Command::new("sudo").arg("-S").arg("locale-gen").stdin(Stdio::inherit()).output().await?; - - if !locale_gen.status.success() { - eprintln!("ERROR: Failed to run locale-gen as root"); - eprintln!("{}", String::from_utf8_lossy(&out.stderr)); - return Ok(ExitCode::FAILURE); - } - } // Disable styling for stdout and stderr since // some tests rely on output not being styled set_colors_enabled(false); From 9800307d9fc177b9b65d9a09626c23dbb2771a94 Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Sun, 10 Sep 2023 15:30:24 +0530 Subject: [PATCH 55/62] chore(tests): include locale setup comment --- tests/datetime/formatTime.luau | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/datetime/formatTime.luau b/tests/datetime/formatTime.luau index 7f588e45..a3ae6462 100644 --- a/tests/datetime/formatTime.luau +++ b/tests/datetime/formatTime.luau @@ -23,6 +23,9 @@ assert( ) -- This test requires 'fr_FR.UTF-8 UTF-8' to be in /etc/locale.gen to pass +-- Locale should be set up by a script, or by the user, or in CI, test runner +-- takes no responsibility for this + -- Local Timezone assert( From d3dd11313f1c49e619c1fce20b2c703b729318eb Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Sun, 10 Sep 2023 15:37:13 +0530 Subject: [PATCH 56/62] fix(tests): import std::process::ExitCode --- src/tests.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests.rs b/src/tests.rs index b875b098..ba6e7187 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -1,4 +1,4 @@ -use std::process::Stdio; +use std::process::ExitCode; use anyhow::Result; use console::set_colors_enabled; From fcb20571158911188c0e651e84f4155e5969d448 Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Mon, 11 Sep 2023 18:02:19 +0530 Subject: [PATCH 57/62] fix(tests): put locale tests behind flag lock --- tests/datetime/formatTime.luau | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/tests/datetime/formatTime.luau b/tests/datetime/formatTime.luau index a3ae6462..f232f864 100644 --- a/tests/datetime/formatTime.luau +++ b/tests/datetime/formatTime.luau @@ -8,12 +8,6 @@ assert( "invalid ISO 8601 formatting for DateTime.formatTime() (UTC)" ) -assert( - DateTime.fromUnixTimestamp(1693068988):formatTime("utc", "%A, %d %B %Y", "fr") - == "samedi, 26 août 2023", - "expected format specifier '%A, %d %B %Y' to return 'samedi, 26 août 2023' for locale 'fr' (UTC)" -) - local expectedTimeString = os.date("%Y-%m-%dT%H:%M:%SZ", 1694078954) assert( @@ -23,7 +17,7 @@ assert( ) -- This test requires 'fr_FR.UTF-8 UTF-8' to be in /etc/locale.gen to pass --- Locale should be set up by a script, or by the user, or in CI, test runner +-- Locale should be set up by a script, or by the user, or in CI, test runner -- takes no responsibility for this -- Local Timezone @@ -34,6 +28,21 @@ assert( "invalid ISO 8601 formatting for DateTime.formatTime() (local)" ) +-- To run tests related to locales, one must explicitly +-- provide the `--test-locales` flag +local toTestLocales = false + +for _, arg in process.args do + if arg == "--test-locales" then + toTestLocales = true + break + end +end + +if not toTestLocales then + return true +end + local expectedLocalizedString local dateCmd = process.spawn("bash", { "-c", "date +\"%A, %d %B %Y\" --date='@1693068988'" }, { @@ -53,3 +62,9 @@ assert( == expectedLocalizedString, `expected format specifier '%A, %d %B %Y' to return '{expectedLocalizedString}' for locale 'fr' (local)` ) + +assert( + DateTime.fromUnixTimestamp(1693068988):formatTime("utc", "%A, %d %B %Y", "fr") + == "samedi, 26 août 2023", + "expected format specifier '%A, %d %B %Y' to return 'samedi, 26 août 2023' for locale 'fr' (UTC)" +) From 7e285f3ef6ddb711792ca58adaeaae94113dcce9 Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Mon, 11 Sep 2023 18:04:45 +0530 Subject: [PATCH 58/62] fix: why did I do this again? --- tests/datetime/formatTime.luau | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/datetime/formatTime.luau b/tests/datetime/formatTime.luau index f232f864..e6aac23e 100644 --- a/tests/datetime/formatTime.luau +++ b/tests/datetime/formatTime.luau @@ -40,7 +40,7 @@ for _, arg in process.args do end if not toTestLocales then - return true + return end local expectedLocalizedString From e70cabcc10a59f69f98ea92e20159183d96e13ee Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Mon, 11 Sep 2023 22:19:05 +0530 Subject: [PATCH 59/62] fix: remove match and replace with num-traits `from_u32` [skip ci] --- src/lune/builtins/datetime/date_time.rs | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/src/lune/builtins/datetime/date_time.rs b/src/lune/builtins/datetime/date_time.rs index 4ecda567..6d3e1e0e 100644 --- a/src/lune/builtins/datetime/date_time.rs +++ b/src/lune/builtins/datetime/date_time.rs @@ -1,6 +1,7 @@ use crate::lune::builtins::datetime::builder::DateTimeBuilder; use chrono::prelude::*; use chrono::DateTime as ChronoDateTime; +use num_traits::FromPrimitive; /// Possible types of timestamps accepted by `DateTime`. pub enum TimestampType { @@ -168,27 +169,9 @@ impl DateTime { { let mut date_time_constructor = DateTimeBuilder::default(); - // Any less tedious way to get Enum member based on index? - // I know there's some crates available with derive macros for this, - // would it be okay if used some of them? - date_time_constructor .with_year(date_time.year()) - .with_month(match date_time.month() { - 1 => Ok(Month::January), - 2 => Ok(Month::February), - 3 => Ok(Month::March), - 4 => Ok(Month::April), - 5 => Ok(Month::May), - 6 => Ok(Month::June), - 7 => Ok(Month::July), - 8 => Ok(Month::August), - 9 => Ok(Month::September), - 10 => Ok(Month::October), - 11 => Ok(Month::November), - 12 => Ok(Month::December), - _ => Err(()), - }?) + .with_month(Month::from_u32(date_time.month()).ok_or(())?) .with_day(date_time.day()) .with_hour(date_time.hour()) .with_minute(date_time.minute()) From 19270d37afa323c1817a174eec3bc003814883d0 Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Mon, 11 Sep 2023 22:20:32 +0530 Subject: [PATCH 60/62] chore(crate): include num-traits dependency --- Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.toml b/Cargo.toml index 216b5b98..0331fa79 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -109,6 +109,7 @@ tokio-tungstenite = { version = "0.20", features = ["rustls-tls-webpki-roots"] } ### DATETIME chrono = "0.4.29" chrono_lc = "0.1.3" +num-traits = "0.2.16" ### CLI From 207af8e3dc59ee4dbe7a4beb29d1ebdad5db92fe Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Mon, 11 Sep 2023 22:20:58 +0530 Subject: [PATCH 61/62] chore: include updated lockfile --- Cargo.lock | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.lock b/Cargo.lock index 792d82fb..4aca39b0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1122,6 +1122,7 @@ dependencies = [ "itertools", "lz4_flex", "mlua", + "num-traits", "once_cell", "os_str_bytes", "path-clean", From e68d5eb20769a547f4e11c1df4cdb9dca9d6195d Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Mon, 11 Sep 2023 22:52:09 +0530 Subject: [PATCH 62/62] chore(tests): fix failing test by accounting for minor inaccuracy --- tests/datetime/fromUniversalTime.luau | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/datetime/fromUniversalTime.luau b/tests/datetime/fromUniversalTime.luau index e172e1f9..fff5641b 100644 --- a/tests/datetime/fromUniversalTime.luau +++ b/tests/datetime/fromUniversalTime.luau @@ -1,7 +1,7 @@ local DateTime = require("@lune/DateTime") assert( - DateTime.fromUniversalTime()["unixTimestamp"] == os.time(), + math.abs(DateTime.fromUniversalTime()["unixTimestamp"] - os.time()) <= 3, "expected DateTime.fromLocalTime() with no args to return DateTime at the current moment" )