From ff7958c7d9a6f7c0ae84e9d3735a188e80034942 Mon Sep 17 00:00:00 2001 From: Philippe Assis Date: Thu, 26 Dec 2024 11:11:32 -0300 Subject: [PATCH 1/3] Update .gitignore and enhance VSCode settings with color customizations --- .gitignore | 2 +- .vscode/settings.json | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index f7c0eba..aee5766 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ /target -*.parquet \ No newline at end of file +*.parquet diff --git a/.vscode/settings.json b/.vscode/settings.json index fb1d326..92be86a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,5 +2,12 @@ "rust-analyzer.linkedProjects": [ "./valu3/Cargo.toml", "./valu3/Cargo.toml" - ] + ], + "workbench.colorCustomizations": { + "[Material Theme Darker High Contrast]": {}, + "[Material Theme Darker]": {}, + "activityBar.background": "#131E83", + "titleBar.activeBackground": "#1A29B7", + "titleBar.activeForeground": "#FBFBFE" + } } \ No newline at end of file From b7b7175f1512e1f84aa56e30a7a44e5c1faea518 Mon Sep 17 00:00:00 2001 From: Philippe Assis Date: Thu, 26 Dec 2024 11:11:40 -0300 Subject: [PATCH 2/3] Add .vscode to .gitignore to exclude VSCode settings from version control --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index aee5766..d094a2c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /target *.parquet +.vscode \ No newline at end of file From 1a319afc7462bffafdffda09e2f653f36cdd5f87 Mon Sep 17 00:00:00 2001 From: Philippe Assis Date: Thu, 26 Dec 2024 11:22:50 -0300 Subject: [PATCH 3/3] Bump version to 0.6.3 and update dependencies; enhance pull request workflows and improve README badges --- .github/workflows/publish.yml | 10 ++--- .github/workflows/pull-request.yml | 1 - Cargo.lock | 68 +++++++++++++++--------------- README.md | 6 +-- VERSION.txt | 2 +- retag.sh | 12 ++++++ valu3/Cargo.toml | 16 +++---- valu3/README.md | 6 +-- valu3/src/types/datetime.rs | 7 +-- valu3/src/types/stringb.rs | 4 +- valu3_derive/Cargo.toml | 8 ++-- valu3_derive/README.md | 6 +-- 12 files changed, 80 insertions(+), 66 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 184f414..2db0c66 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -3,11 +3,11 @@ name: Tagging and Publish on: push: branches: - - main - + - main + permissions: write-all -env: +env: CARGO_TERM_COLOR: always CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} @@ -45,8 +45,8 @@ jobs: git tag "$VERSION" git push origin "$VERSION" env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + valu3_derive_publish: needs: tag name: Valu3 Derive - latest diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 57080b3..ed543b7 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -20,4 +20,3 @@ jobs: - run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} - run: cargo build --verbose - run: cargo test --verbose - diff --git a/Cargo.lock b/Cargo.lock index 4a1a898..1bf5cfc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -70,9 +70,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.38" +version = "0.4.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825" dependencies = [ "android-tzdata", "iana-time-zone", @@ -211,9 +211,9 @@ checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "pest" -version = "2.7.13" +version = "2.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdbef9d1d47087a895abd220ed25eb4ad973a5e26f6a4367b038c25e28dfc2d9" +checksum = "8b7cafe60d6cf8e62e1b9b2ea516a089c008945bb5a275416789e7db0bc199dc" dependencies = [ "memchr", "thiserror", @@ -222,9 +222,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.7.13" +version = "2.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d3a6e3394ec80feb3b6393c725571754c6188490265c61aaf260810d6b95aa0" +checksum = "816518421cfc6887a0d62bf441b6ffb4536fcc926395a69e1a85852d4363f57e" dependencies = [ "pest", "pest_generator", @@ -232,9 +232,9 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.13" +version = "2.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94429506bde1ca69d1b5601962c73f4172ab4726571a59ea95931218cb0e930e" +checksum = "7d1396fd3a870fc7838768d171b4616d5c91f6cc25e377b673d714567d99377b" dependencies = [ "pest", "pest_meta", @@ -245,9 +245,9 @@ dependencies = [ [[package]] name = "pest_meta" -version = "2.7.13" +version = "2.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac8a071862e93690b6e34e9a5fb8e33ff3734473ac0245b27232222c4906a33f" +checksum = "e1e58089ea25d717bfd31fb534e4f3afcc2cc569c70de3e239778991ea3b7dea" dependencies = [ "once_cell", "pest", @@ -262,18 +262,18 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" dependencies = [ "proc-macro2", ] @@ -310,9 +310,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.6" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", @@ -322,9 +322,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.5" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", @@ -333,9 +333,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.2" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "ryu" @@ -345,18 +345,18 @@ checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" [[package]] name = "serde" -version = "1.0.210" +version = "1.0.216" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +checksum = "0b9781016e935a97e8beecf0c933758c97a5520d32930e460142b4cd80c6338e" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.210" +version = "1.0.216" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e" dependencies = [ "proc-macro2", "quote", @@ -365,9 +365,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.128" +version = "1.0.134" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" +checksum = "d00f4175c42ee48b15416f6193a959ba3a0d67fc699a0db9ad12df9f83991c7d" dependencies = [ "itoa", "memchr", @@ -388,9 +388,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.77" +version = "2.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" +checksum = "d53cbcb5a243bd33b7858b1d7f4aca2153490815872d86d955d6ea29f743c035" dependencies = [ "proc-macro2", "quote", @@ -399,18 +399,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.43" +version = "2.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a35fc5b8971143ca348fa6df4f024d4d55264f3468c71ad1c2f365b0a4d58c42" +checksum = "f072643fd0190df67a8bab670c20ef5d8737177d6ac6b2e9a236cb096206b2cc" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.43" +version = "2.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "463fe12d7993d3b327787537ce8dd4dfa058de32fc2b195ef3cde03dc4771e8f" +checksum = "7b50fa271071aae2e6ee85f842e2e28ba8cd2c5fb67f11fcb1fd70b276f9e7d4" dependencies = [ "proc-macro2", "quote", @@ -437,7 +437,7 @@ checksum = "22049a19f4a68748a168c0fc439f9516686aa045927ff767eca0a85101fb6e73" [[package]] name = "valu3" -version = "0.6.2" +version = "0.6.3" dependencies = [ "bincode", "chrono", @@ -452,7 +452,7 @@ dependencies = [ [[package]] name = "valu3-derive" -version = "0.6.2" +version = "0.6.3" dependencies = [ "proc-macro2", "quote", diff --git a/README.md b/README.md index 1636e02..1bb1a7c 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,11 @@ Welcome to **Valu3** - the ultimate, flexible, and powerful library for manipulating diverse data types in your Rust projects. Say goodbye to the complexity of handling numbers, strings, arrays, objects, and datetime values. Valu3 is here to make your life easier! -[![crates.io](https://img.shields.io/crates/v/valu3?label=0.6.2)](https://crates.io/crates/valu3) -[![Documentation](https://docs.rs/valu3/badge.svg?version=0.6.2)](https://docs.rs/valu3/0.6.2) +[![crates.io](https://img.shields.io/crates/v/valu3?label=0.6.3)](https://crates.io/crates/valu3) +[![Documentation](https://docs.rs/valu3/badge.svg?version=0.6.3)](https://docs.rs/valu3/0.6.3) ![MSRV](https://img.shields.io/badge/rustc-1.59+-ab6000.svg) ![MIT or Apache 2.0 licensed](https://img.shields.io/crates/l/actix-web.svg) -[![Dependency Status](https://deps.rs/crate/valu3/0.6.2/status.svg)](https://deps.rs/crate/valu3/0.6.2) +[![Dependency Status](https://deps.rs/crate/valu3/0.6.3/status.svg)](https://deps.rs/crate/valu3/0.6.3) ![Main test](https://github.com/cogup/valu3/actions/workflows/main-test.yml/badge.svg) [![codecov](https://codecov.io/gh/cogup/valu3/branch/master/graph/badge.svg)](https://codecov.io/gh/cogup/valu3) ![downloads](https://img.shields.io/crates/d/valu3.svg) diff --git a/VERSION.txt b/VERSION.txt index b1d7abc..a0a1517 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -0.6.2 \ No newline at end of file +0.6.3 \ No newline at end of file diff --git a/retag.sh b/retag.sh index 0759f0c..5be5438 100644 --- a/retag.sh +++ b/retag.sh @@ -1,5 +1,17 @@ #!/bin/bash +# This script replaces the old tag with the new tag in the files listed in the files array. +# Usage: ./retag.sh +# Example: ./retag.sh 0.1.0 + +# -h or --help: Show help message +if [ "$1" == "-h" ] || [ "$1" == "--help" ]; then + echo "This script replaces the old tag with the new tag in the files listed in the files array." + echo "Usage: ./retag.sh " + echo "Example: ./retag.sh 0.1.0" + exit 0 +fi + # Verifica se o arquivo VERSION.txt existe if [ ! -f "VERSION.txt" ]; then echo "Arquivo VERSION.txt não encontrado." diff --git a/valu3/Cargo.toml b/valu3/Cargo.toml index 7f9784a..c812676 100644 --- a/valu3/Cargo.toml +++ b/valu3/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "valu3" -version = "0.6.2" +version = "0.6.3" edition = "2021" license = "MIT OR Apache-2.0" readme = "crates-io.md" @@ -12,17 +12,17 @@ categories = ["encoding", "no-std", "parsing"] documentation = "https://docs.rs/valu3" [dependencies] -pest="2.7.13" -pest_derive="2.7.13" -regex = "1.10.6" -chrono = "0.4.38" -serde = { version = "1.0.210", features = ["derive"], optional = true } -valu3-derive = { path = "../valu3_derive", optional = true, version = "0.6.2"} +pest="2.7.15" +pest_derive="2.7.15" +regex = "1.11.1" +chrono = "0.4.39" +serde = { version = "1.0.216", features = ["derive"], optional = true } +valu3-derive = { path = "../valu3_derive", optional = true, version = "0.6.3"} bincode = { version = "1.3.3", optional = true } [dev-dependencies] rand = "0.8.5" -serde_json = "1.0.128" +serde_json = "1.0.134" [features] default = ["parser", "derive", "serde", "bin"] diff --git a/valu3/README.md b/valu3/README.md index 1636e02..1bb1a7c 100644 --- a/valu3/README.md +++ b/valu3/README.md @@ -3,11 +3,11 @@ Welcome to **Valu3** - the ultimate, flexible, and powerful library for manipulating diverse data types in your Rust projects. Say goodbye to the complexity of handling numbers, strings, arrays, objects, and datetime values. Valu3 is here to make your life easier! -[![crates.io](https://img.shields.io/crates/v/valu3?label=0.6.2)](https://crates.io/crates/valu3) -[![Documentation](https://docs.rs/valu3/badge.svg?version=0.6.2)](https://docs.rs/valu3/0.6.2) +[![crates.io](https://img.shields.io/crates/v/valu3?label=0.6.3)](https://crates.io/crates/valu3) +[![Documentation](https://docs.rs/valu3/badge.svg?version=0.6.3)](https://docs.rs/valu3/0.6.3) ![MSRV](https://img.shields.io/badge/rustc-1.59+-ab6000.svg) ![MIT or Apache 2.0 licensed](https://img.shields.io/crates/l/actix-web.svg) -[![Dependency Status](https://deps.rs/crate/valu3/0.6.2/status.svg)](https://deps.rs/crate/valu3/0.6.2) +[![Dependency Status](https://deps.rs/crate/valu3/0.6.3/status.svg)](https://deps.rs/crate/valu3/0.6.3) ![Main test](https://github.com/cogup/valu3/actions/workflows/main-test.yml/badge.svg) [![codecov](https://codecov.io/gh/cogup/valu3/branch/master/graph/badge.svg)](https://codecov.io/gh/cogup/valu3) ![downloads](https://img.shields.io/crates/d/valu3.svg) diff --git a/valu3/src/types/datetime.rs b/valu3/src/types/datetime.rs index d0de683..8122b46 100644 --- a/valu3/src/types/datetime.rs +++ b/valu3/src/types/datetime.rs @@ -123,7 +123,7 @@ impl From<&str> for DateTime { impl From for DateTime { fn from(value: i64) -> Self { DateTime::DateTime(ChDateTime::from_naive_utc_and_offset( - chrono::NaiveDateTime::from_timestamp_nanos(value).unwrap(), + chrono::DateTime::from_timestamp_nanos(value).naive_local(), Utc, )) } @@ -214,12 +214,13 @@ impl DateTimeBehavior for DateTime { fn timestamp(&self) -> Option { match self { DateTime::DateTime(datetime) => Some(datetime.timestamp()), - DateTime::Date(date) => Some(date.and_hms_opt(0, 0, 0).unwrap().timestamp()), + DateTime::Date(date) => Some(date.and_hms_opt(0, 0, 0).unwrap().and_utc().timestamp()), DateTime::Time(time) => Some( NaiveDate::from_ymd_opt(1970, 1, 1) .unwrap() .and_hms_opt(time.hour(), time.minute(), time.second()) .unwrap() + .and_utc() .timestamp(), ), } @@ -370,7 +371,7 @@ mod tests { assert_eq!( dt_date.timestamp(), - Some(date.and_hms_opt(0, 0, 0).unwrap().timestamp()) + Some(date.and_hms_opt(0, 0, 0).unwrap().and_utc().timestamp()) ); assert_eq!(dt_datetime.timestamp(), Some(datetime.unwrap().timestamp())); } diff --git a/valu3/src/types/stringb.rs b/valu3/src/types/stringb.rs index cf0ddc2..2ed912c 100644 --- a/valu3/src/types/stringb.rs +++ b/valu3/src/types/stringb.rs @@ -3,6 +3,8 @@ //! This implementation offers a way to handle strings with additional features, such as converting //! the string to uppercase or lowercase, trimming, replacing, and concatenating. It also handles //! converting between different representations of strings, such as `CString`, `String`, and `Vec`. +#[cfg(feature = "cstring")] +use std::ffi::CString; use std::fmt::{Display, Formatter}; use std::ops::Deref; @@ -118,7 +120,7 @@ impl StringB { pub fn as_string(&self) -> String { self.value.to_str().unwrap().to_string() } - + #[cfg(not(feature = "cstring"))] pub fn as_string(&self) -> String { self.value.clone() diff --git a/valu3_derive/Cargo.toml b/valu3_derive/Cargo.toml index 4406e85..99f162f 100644 --- a/valu3_derive/Cargo.toml +++ b/valu3_derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "valu3-derive" -version = "0.6.2" +version = "0.6.3" edition = "2021" license = "MIT OR Apache-2.0" readme = "crates-io.md" @@ -13,9 +13,9 @@ documentation = "https://docs.rs/valu3-derive" [dependencies] -syn = { version = "2.0.77", features = ["full"] } -quote = "1.0.37" -proc-macro2 = "1.0.86" +syn = { version = "2.0.91", features = ["full"] } +quote = "1.0.38" +proc-macro2 = "1.0.92" [lib] proc-macro = true \ No newline at end of file diff --git a/valu3_derive/README.md b/valu3_derive/README.md index 1636e02..1bb1a7c 100644 --- a/valu3_derive/README.md +++ b/valu3_derive/README.md @@ -3,11 +3,11 @@ Welcome to **Valu3** - the ultimate, flexible, and powerful library for manipulating diverse data types in your Rust projects. Say goodbye to the complexity of handling numbers, strings, arrays, objects, and datetime values. Valu3 is here to make your life easier! -[![crates.io](https://img.shields.io/crates/v/valu3?label=0.6.2)](https://crates.io/crates/valu3) -[![Documentation](https://docs.rs/valu3/badge.svg?version=0.6.2)](https://docs.rs/valu3/0.6.2) +[![crates.io](https://img.shields.io/crates/v/valu3?label=0.6.3)](https://crates.io/crates/valu3) +[![Documentation](https://docs.rs/valu3/badge.svg?version=0.6.3)](https://docs.rs/valu3/0.6.3) ![MSRV](https://img.shields.io/badge/rustc-1.59+-ab6000.svg) ![MIT or Apache 2.0 licensed](https://img.shields.io/crates/l/actix-web.svg) -[![Dependency Status](https://deps.rs/crate/valu3/0.6.2/status.svg)](https://deps.rs/crate/valu3/0.6.2) +[![Dependency Status](https://deps.rs/crate/valu3/0.6.3/status.svg)](https://deps.rs/crate/valu3/0.6.3) ![Main test](https://github.com/cogup/valu3/actions/workflows/main-test.yml/badge.svg) [![codecov](https://codecov.io/gh/cogup/valu3/branch/master/graph/badge.svg)](https://codecov.io/gh/cogup/valu3) ![downloads](https://img.shields.io/crates/d/valu3.svg)