Skip to content

Commit f4d36a9

Browse files
chore: The range of supported schemars versions is extended to >=0.8.22, <2 tu support the latest 1.0 release (#34)
- Makes schemars version available from 0.8.22 to less than 2.0 - uses rust 1.74 (as schemars_derive v1.0.3 can't be compiled with 1.70) note: #28
1 parent 96abe71 commit f4d36a9

File tree

7 files changed

+11
-8
lines changed

7 files changed

+11
-8
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
test-all:
2525
runs-on: ubuntu-latest
2626
container:
27-
image: rust:1.70.0
27+
image: rust:1.74.0
2828
steps:
2929
- uses: actions/checkout@v3
3030
- uses: Swatinem/rust-cache@v1
@@ -35,7 +35,7 @@ jobs:
3535
clippy:
3636
runs-on: ubuntu-latest
3737
container:
38-
image: rust:1.70.0
38+
image: rust:1.74.0
3939
steps:
4040
- uses: actions/checkout@v3
4141
- uses: Swatinem/rust-cache@v1

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ schemars-alpha = ["schemars", "dep:schemars-alpha"]
2323
arbitrary = { version = "1", features = ["derive"] , optional = true }
2424
borsh = { version = "1.0.0", optional = true }
2525
serde = { version = "1.0.119", features = ["alloc", "derive", "rc"], optional = true }
26-
schemars-stable = { version = "0.8.22", optional = true, package = "schemars" }
26+
schemars-stable = { version = ">=0.8.22,<2", optional = true, package = "schemars" }
2727
schemars-alpha = { version = "1.0.0-alpha.17", optional = true, package = "schemars" }
2828

2929
[dev-dependencies]

src/account_id.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use std::{borrow::Cow, fmt, ops::Deref, str::FromStr};
22

3-
use crate::{AccountIdRef, ParseAccountError};
43
#[cfg(feature = "schemars")]
54
use crate::schemars_exports::schemars;
5+
use crate::{AccountIdRef, ParseAccountError};
66

77
/// NEAR Account Identifier.
88
///

src/account_id_ref.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use std::borrow::Cow;
22

3-
use crate::{AccountId, ParseAccountError};
43
#[cfg(feature = "schemars")]
54
use crate::schemars_exports::schemars;
5+
use crate::{AccountId, ParseAccountError};
66

77
/// Account identifier. This is the human readable UTF-8 string which is used internally to index
88
/// accounts on the network and their respective state.

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@
3737
3838
mod errors;
3939

40-
mod schemars_exports;
4140
mod account_id;
4241
mod account_id_ref;
4342
#[cfg(feature = "borsh")]
4443
mod borsh;
44+
mod schemars_exports;
4545
#[cfg(feature = "serde")]
4646
mod serde;
4747
#[cfg(test)]

src/schemars_exports.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
pub use schemars_alpha as schemars;
33

44
#[cfg(feature = "schemars-stable")]
5-
pub use schemars_stable as schemars;
5+
pub use schemars_stable as schemars;

src/validation.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,10 @@ pub fn validate(account_id: &str) -> Result<(), ParseAccountError> {
9696
pub fn is_eth_implicit(account_id: &str) -> bool {
9797
account_id.len() == 42
9898
&& account_id.starts_with("0x")
99-
&& account_id[2..].as_bytes().iter().all(|b| matches!(b, b'a'..=b'f' | b'0'..=b'9'))
99+
&& account_id[2..]
100+
.as_bytes()
101+
.iter()
102+
.all(|b| matches!(b, b'a'..=b'f' | b'0'..=b'9'))
100103
}
101104

102105
pub fn is_near_implicit(account_id: &str) -> bool {

0 commit comments

Comments
 (0)