diff --git a/.appveyor.yml b/.appveyor.yml index 0224cc2..fba9a7a 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -22,7 +22,7 @@ install: - curl -sSf -o rustup-init.exe https://win.rustup.rs - rustup-init.exe -y --default-host %TARGET% --default-toolchain none --no-modify-path - rustup --version - - rustup toolchain install --profile minimal beta-%TARGET% 1.43.0-%TARGET% + - rustup toolchain install --profile minimal beta-%TARGET% 1.44.0-%TARGET% - rustup component add --toolchain beta-%TARGET% rustfmt clippy build: false @@ -51,7 +51,7 @@ test_script: - cargo +beta-%TARGET% check --all-targets --features fail-on-warnings - cargo +beta-%TARGET% test --release --features "fail-on-warnings az f16 serde" - cargo +beta-%TARGET% fmt -- --check - - cargo +1.43.0-%TARGET% test --lib --features "fail-on-warnings az f16 serde" + - cargo +1.44.0-%TARGET% test --lib --features "fail-on-warnings az f16 serde" after_test: - bash -c "if [ -d $USERPROFILE/.cargo/registry/cache ]; then cd $USERPROFILE/.cargo/registry; for c in cache/*/*.crate; do s=src/${c#cache/}; if [ ! -e ${s/.crate/} ]; then rm -v $c; fi; done; find cache -name \*.crate | sort; fi" diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f8091c8..4de7b6e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,7 +9,7 @@ before_script: - getconf LONG_BIT - rustup self update - rustup --version - - rustup toolchain install --profile minimal beta-$TARGET 1.43.0-$TARGET + - rustup toolchain install --profile minimal beta-$TARGET 1.44.0-$TARGET - rustup component add --toolchain beta-$TARGET rustfmt clippy - if [ -d cargo/registry/cache ]; then rm -rf $CARGO_HOME/registry/cache; mkdir -p $CARGO_HOME/registry; cp -R cargo/registry/cache $CARGO_HOME/registry/; echo Copied registry/cache; fi - if [ -d $CARGO_HOME/registry/src ]; then rm -r $CARGO_HOME/registry/src; fi @@ -50,8 +50,8 @@ x86_64-gnulinux: - cargo +beta-$TARGET test --features "fail-on-warnings az f16 serde std" - cargo +beta-$TARGET test --release --features "fail-on-warnings az f16 serde std" - cargo +beta-$TARGET fmt -- --check - - cargo +1.43.0-$TARGET test --lib --features "fail-on-warnings az f16 serde std" - - cargo +1.43.0-$TARGET test --release --lib --features "fail-on-warnings az f16 serde std" + - cargo +1.44.0-$TARGET test --lib --features "fail-on-warnings az f16 serde std" + - cargo +1.44.0-$TARGET test --release --lib --features "fail-on-warnings az f16 serde std" i686-gnulinux: image: i386/rust:1 @@ -82,8 +82,8 @@ i686-gnulinux: - cargo +beta-$TARGET test --features "fail-on-warnings f16 serde" - cargo +beta-$TARGET test --release --features "fail-on-warnings az f16 serde std" - cargo +beta-$TARGET fmt -- --check - - cargo +1.43.0-$TARGET test --lib --features "fail-on-warnings az f16 serde std" - - cargo +1.43.0-$TARGET test --release --lib --features "fail-on-warnings az f16 serde std" + - cargo +1.44.0-$TARGET test --lib --features "fail-on-warnings az f16 serde std" + - cargo +1.44.0-$TARGET test --release --lib --features "fail-on-warnings az f16 serde std" x86_64-gnulinux-tarpaulin: image: amd64/rust:1 diff --git a/README.md b/README.md index 17f5f8e..6e67030 100644 --- a/README.md +++ b/README.md @@ -80,9 +80,21 @@ The conversions supported cover the following cases. ### Version 1.0.0 news (unreleased) - * The crate now requires rustc version 1.43.0 or later. + * The crate now requires rustc version 1.44.0 or later. + * The following methods are now `const` functions: + * [`from_be_bytes`][f-fbb-1-0], [`from_le_bytes`][f-flb-1-0], + [`from_ne_bytes`][f-fnb-1-0] + * [`to_be_bytes`][f-tbb-1-0], [`to_le_bytes`][f-tlb-1-0], + [`to_ne_bytes`][f-tnb-1-0] * All deprecated items were removed. +[f-fbb-1-0]: https://tspiteri.gitlab.io/fixed/dev/fixed/struct.FixedI32.html#method.from_be_bytes +[f-flb-1-0]: https://tspiteri.gitlab.io/fixed/dev/fixed/struct.FixedI32.html#method.from_le_bytes +[f-fnb-1-0]: https://tspiteri.gitlab.io/fixed/dev/fixed/struct.FixedI32.html#method.from_ne_bytes +[f-tbb-1-0]: https://tspiteri.gitlab.io/fixed/dev/fixed/struct.FixedI32.html#method.to_be_bytes +[f-tlb-1-0]: https://tspiteri.gitlab.io/fixed/dev/fixed/struct.FixedI32.html#method.to_le_bytes +[f-tnb-1-0]: https://tspiteri.gitlab.io/fixed/dev/fixed/struct.FixedI32.html#method.to_ne_bytes + ### Version 0.5.7 news (2020-05-11) * The [`LosslessTryFrom`][ltf-0-5-7] and @@ -204,7 +216,7 @@ it in your crate, add it as a dependency inside [*Cargo.toml*]: fixed = "0.5.7" ``` -The *fixed* crate requires rustc version 1.43.0 or later. +The *fixed* crate requires rustc version 1.44.0 or later. ## Optional features diff --git a/RELEASES.md b/RELEASES.md index b682bd6..2276f4d 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -8,9 +8,21 @@ as-is, without any warranty. --> Version 1.0.0 (unreleased) ========================== - * The crate now requires rustc version 1.43.0 or later. + * The crate now requires rustc version 1.44.0 or later. + * The following methods are now `const` functions: + * [`from_be_bytes`][f-fbb-1-0], [`from_le_bytes`][f-flb-1-0], + [`from_ne_bytes`][f-fnb-1-0] + * [`to_be_bytes`][f-tbb-1-0], [`to_le_bytes`][f-tlb-1-0], + [`to_ne_bytes`][f-tnb-1-0] * All deprecated items were removed. +[f-fbb-1-0]: https://tspiteri.gitlab.io/fixed/dev/fixed/struct.FixedI32.html#method.from_be_bytes +[f-flb-1-0]: https://tspiteri.gitlab.io/fixed/dev/fixed/struct.FixedI32.html#method.from_le_bytes +[f-fnb-1-0]: https://tspiteri.gitlab.io/fixed/dev/fixed/struct.FixedI32.html#method.from_ne_bytes +[f-tbb-1-0]: https://tspiteri.gitlab.io/fixed/dev/fixed/struct.FixedI32.html#method.to_be_bytes +[f-tlb-1-0]: https://tspiteri.gitlab.io/fixed/dev/fixed/struct.FixedI32.html#method.to_le_bytes +[f-tnb-1-0]: https://tspiteri.gitlab.io/fixed/dev/fixed/struct.FixedI32.html#method.to_ne_bytes + Version 0.5.7 (2020-05-11) ========================== diff --git a/src/lib.rs b/src/lib.rs index cfbfd82..9bb6ff6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -150,7 +150,7 @@ it in your crate, add it as a dependency inside [*Cargo.toml*]: fixed = "0.5.7" ``` -The *fixed* crate requires rustc version 1.43.0 or later. +The *fixed* crate requires rustc version 1.44.0 or later. ## Optional features diff --git a/src/macros_no_frac.rs b/src/macros_no_frac.rs index 7a18ab5..2045671 100644 --- a/src/macros_no_frac.rs +++ b/src/macros_no_frac.rs @@ -107,7 +107,7 @@ assert_eq!( ``` "; #[inline] - pub fn from_be_bytes(bytes: [u8; $nbytes]) -> $Fixed { + pub const fn from_be_bytes(bytes: [u8; $nbytes]) -> $Fixed { $Fixed::from_bits(<$Inner>::from_be_bytes(bytes)) } } @@ -128,7 +128,7 @@ assert_eq!( ``` "; #[inline] - pub fn from_le_bytes(bytes: [u8; $nbytes]) -> $Fixed { + pub const fn from_le_bytes(bytes: [u8; $nbytes]) -> $Fixed { $Fixed::from_bits(<$Inner>::from_le_bytes(bytes)) } } @@ -153,7 +153,7 @@ assert_eq!( ``` "; #[inline] - pub fn from_ne_bytes(bytes: [u8; $nbytes]) -> $Fixed { + pub const fn from_ne_bytes(bytes: [u8; $nbytes]) -> $Fixed { $Fixed::from_bits(<$Inner>::from_ne_bytes(bytes)) } } @@ -175,7 +175,7 @@ assert_eq!( ``` "; #[inline] - pub fn to_be_bytes(self) -> [u8; $nbytes] { + pub const fn to_be_bytes(self) -> [u8; $nbytes] { self.to_bits().to_be_bytes() } } @@ -197,7 +197,7 @@ assert_eq!( ``` "; #[inline] - pub fn to_le_bytes(self) -> [u8; $nbytes] { + pub const fn to_le_bytes(self) -> [u8; $nbytes] { self.to_bits().to_le_bytes() } } @@ -223,7 +223,7 @@ assert_eq!( ``` "; #[inline] - pub fn to_ne_bytes(self) -> [u8; $nbytes] { + pub const fn to_ne_bytes(self) -> [u8; $nbytes] { self.to_bits().to_ne_bytes() } }