Skip to content

Commit b141451

Browse files
authored
Move v3-preview to its own branch (#120)
1 parent 022e711 commit b141451

File tree

13 files changed

+77
-1634
lines changed

13 files changed

+77
-1634
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
- uses: actions/checkout@v4
1717
- run: rustup install nightly
1818
- run: rustup component add --toolchain=nightly clippy miri rustfmt
19+
- run: cargo +nightly install cargo-audit --locked
1920
- name: cd lib && cargo +nightly fmt -- --check
2021
run: cargo +nightly fmt -- --check
2122
working-directory: lib
@@ -76,24 +77,6 @@ jobs:
7677
- name: cd lib && cargo +nightly build --release --no-default-features
7778
run: cargo +nightly build --release --no-default-features
7879
working-directory: lib
79-
- name: cd lib && cargo +nightly build --features=v3-preview
80-
run: cargo +nightly build --features=v3-preview
81-
working-directory: lib
82-
- name: cd lib && cargo +nightly build --release --features=v3-preview
83-
run: cargo +nightly build --release --features=v3-preview
84-
working-directory: lib
85-
- name: cd lib && cargo +nightly build --no-default-features --features=alloc --features=v3-preview
86-
run: cargo +nightly build --no-default-features --features=alloc --features=v3-preview
87-
working-directory: lib
88-
- name: cd lib && cargo +nightly build --release --no-default-features --features=alloc --features=v3-preview
89-
run: cargo +nightly build --release --no-default-features --features=alloc --features=v3-preview
90-
working-directory: lib
91-
- name: cd lib && cargo +nightly build --no-default-features --features=v3-preview
92-
run: cargo +nightly build --no-default-features --features=v3-preview
93-
working-directory: lib
94-
- name: cd lib && cargo +nightly build --release --no-default-features --features=v3-preview
95-
run: cargo +nightly build --release --no-default-features --features=v3-preview
96-
working-directory: lib
9780
- name: cd lib/macro/internal && cargo +nightly build
9881
run: cargo +nightly build
9982
working-directory: lib/macro/internal
@@ -127,9 +110,6 @@ jobs:
127110
- name: cd lib && cargo +nightly test
128111
run: cargo +nightly test
129112
working-directory: lib
130-
- name: cd lib && cargo +nightly test --features=v3-preview
131-
run: cargo +nightly test --features=v3-preview
132-
working-directory: lib
133113
- name: cd lib/macro/internal && cargo +nightly test
134114
run: cargo +nightly test
135115
working-directory: lib/macro/internal
@@ -160,15 +140,9 @@ jobs:
160140
- name: cd lib && cargo +nightly miri test
161141
run: cargo +nightly miri test
162142
working-directory: lib
163-
- name: cd lib && cargo +nightly miri test --features=v3-preview
164-
run: cargo +nightly miri test --features=v3-preview
165-
working-directory: lib
166143
- name: cd lib && cargo +nightly bench
167144
run: cargo +nightly bench
168145
working-directory: lib
169-
- name: cd lib && cargo +nightly bench --features=v3-preview
170-
run: cargo +nightly bench --features=v3-preview
171-
working-directory: lib
172146
- run: cd bin && ./bench.sh +nightly
173147
- name: cd lib && cargo +nightly audit --deny=warnings
174148
run: cargo +nightly audit --deny=warnings
@@ -195,7 +169,7 @@ jobs:
195169
run: cargo +nightly audit --deny=warnings
196170
working-directory: www
197171
- run: rustup install stable
198-
- run: cargo +stable install cargo-semver-checks
172+
- run: cargo +stable install cargo-semver-checks --locked
199173
- name: cd lib && cargo +stable build
200174
run: cargo +stable build
201175
working-directory: lib
@@ -214,24 +188,6 @@ jobs:
214188
- name: cd lib && cargo +stable build --release --no-default-features
215189
run: cargo +stable build --release --no-default-features
216190
working-directory: lib
217-
- name: cd lib && cargo +stable build --features=v3-preview
218-
run: cargo +stable build --features=v3-preview
219-
working-directory: lib
220-
- name: cd lib && cargo +stable build --release --features=v3-preview
221-
run: cargo +stable build --release --features=v3-preview
222-
working-directory: lib
223-
- name: cd lib && cargo +stable build --no-default-features --features=alloc --features=v3-preview
224-
run: cargo +stable build --no-default-features --features=alloc --features=v3-preview
225-
working-directory: lib
226-
- name: cd lib && cargo +stable build --release --no-default-features --features=alloc --features=v3-preview
227-
run: cargo +stable build --release --no-default-features --features=alloc --features=v3-preview
228-
working-directory: lib
229-
- name: cd lib && cargo +stable build --no-default-features --features=v3-preview
230-
run: cargo +stable build --no-default-features --features=v3-preview
231-
working-directory: lib
232-
- name: cd lib && cargo +stable build --release --no-default-features --features=v3-preview
233-
run: cargo +stable build --release --no-default-features --features=v3-preview
234-
working-directory: lib
235191
- name: cd lib/macro/internal && cargo +stable build
236192
run: cargo +stable build
237193
working-directory: lib/macro/internal
@@ -322,24 +278,6 @@ jobs:
322278
- name: cd lib && cargo +nightly build --release --no-default-features
323279
run: cargo +nightly build --release --no-default-features
324280
working-directory: lib
325-
- name: cd lib && cargo +nightly build --features=v3-preview
326-
run: cargo +nightly build --features=v3-preview
327-
working-directory: lib
328-
- name: cd lib && cargo +nightly build --release --features=v3-preview
329-
run: cargo +nightly build --release --features=v3-preview
330-
working-directory: lib
331-
- name: cd lib && cargo +nightly build --no-default-features --features=alloc --features=v3-preview
332-
run: cargo +nightly build --no-default-features --features=alloc --features=v3-preview
333-
working-directory: lib
334-
- name: cd lib && cargo +nightly build --release --no-default-features --features=alloc --features=v3-preview
335-
run: cargo +nightly build --release --no-default-features --features=alloc --features=v3-preview
336-
working-directory: lib
337-
- name: cd lib && cargo +nightly build --no-default-features --features=v3-preview
338-
run: cargo +nightly build --no-default-features --features=v3-preview
339-
working-directory: lib
340-
- name: cd lib && cargo +nightly build --release --no-default-features --features=v3-preview
341-
run: cargo +nightly build --release --no-default-features --features=v3-preview
342-
working-directory: lib
343281
- name: cd lib/macro/internal && cargo +nightly build
344282
run: cargo +nightly build
345283
working-directory: lib/macro/internal
@@ -377,24 +315,6 @@ jobs:
377315
- name: cd lib && cargo +stable build --release --no-default-features
378316
run: cargo +stable build --release --no-default-features
379317
working-directory: lib
380-
- name: cd lib && cargo +stable build --features=v3-preview
381-
run: cargo +stable build --features=v3-preview
382-
working-directory: lib
383-
- name: cd lib && cargo +stable build --release --features=v3-preview
384-
run: cargo +stable build --release --features=v3-preview
385-
working-directory: lib
386-
- name: cd lib && cargo +stable build --no-default-features --features=alloc --features=v3-preview
387-
run: cargo +stable build --no-default-features --features=alloc --features=v3-preview
388-
working-directory: lib
389-
- name: cd lib && cargo +stable build --release --no-default-features --features=alloc --features=v3-preview
390-
run: cargo +stable build --release --no-default-features --features=alloc --features=v3-preview
391-
working-directory: lib
392-
- name: cd lib && cargo +stable build --no-default-features --features=v3-preview
393-
run: cargo +stable build --no-default-features --features=v3-preview
394-
working-directory: lib
395-
- name: cd lib && cargo +stable build --release --no-default-features --features=v3-preview
396-
run: cargo +stable build --release --no-default-features --features=v3-preview
397-
working-directory: lib
398318
- name: cd lib/macro/internal && cargo +stable build
399319
run: cargo +stable build
400320
working-directory: lib/macro/internal

bin/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ name = "data-encoding"
1717
path = "src/main.rs"
1818

1919
[dependencies]
20-
data-encoding = { version = "2.6.1-git", path = "../lib" }
20+
data-encoding = { version = "2.7.0-git", path = "../lib" }
2121
getopts = "0.2"

lib/CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Changelog
22

3-
## 2.6.1-git
3+
## 2.7.0-git
4+
5+
### Minor
6+
7+
- Add `Encoding::encode_display()` for easier formatting (fixes #118)
48

59
### Patch
610

lib/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "data-encoding"
3-
version = "2.6.1-git"
3+
version = "2.7.0-git"
44
authors = ["Julien Cretin <git@ia0.eu>"]
55
license = "MIT"
66
edition = "2018"
@@ -21,4 +21,3 @@ rustdoc-args = ["--cfg=docsrs"]
2121
default = ["std"]
2222
alloc = []
2323
std = ["alloc"]
24-
v3-preview = []

lib/benches/lib.rs

Lines changed: 10 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,6 @@
22

33
extern crate test;
44

5-
#[cfg(feature = "v3-preview")]
6-
use std::convert::TryFrom as _;
7-
8-
#[cfg(not(feature = "v3-preview"))]
9-
use data_encoding as constants;
10-
#[cfg(feature = "v3-preview")]
11-
use data_encoding::v3_preview as constants;
12-
#[cfg(feature = "v3-preview")]
13-
use data_encoding::v3_preview::{Bit1, Bit2, Bit3, Bit6, Encoding, False, True};
145
use data_encoding::Specification;
156
use test::Bencher;
167

@@ -21,8 +12,6 @@ fn base02_encode_base(b: &mut Bencher) {
2112
let mut spec = Specification::new();
2213
spec.symbols.push_str("01");
2314
let base = spec.encoding().unwrap();
24-
#[cfg(feature = "v3-preview")]
25-
let base = Encoding::<Bit1, True, False, False, False>::try_from(base).unwrap();
2615
b.iter(|| base.encode_mut(input, output));
2716
}
2817

@@ -33,8 +22,6 @@ fn base02_decode_base(b: &mut Bencher) {
3322
let mut spec = Specification::new();
3423
spec.symbols.push_str("01");
3524
let base = spec.encoding().unwrap();
36-
#[cfg(feature = "v3-preview")]
37-
let base = Encoding::<Bit1, True, False, False, False>::try_from(base).unwrap();
3825
b.iter(|| base.decode_mut(input, output));
3926
}
4027

@@ -45,8 +32,6 @@ fn base04_encode_base(b: &mut Bencher) {
4532
let mut spec = Specification::new();
4633
spec.symbols.push_str("0123");
4734
let base = spec.encoding().unwrap();
48-
#[cfg(feature = "v3-preview")]
49-
let base = Encoding::<Bit2, True, False, False, False>::try_from(base).unwrap();
5035
b.iter(|| base.encode_mut(input, output));
5136
}
5237

@@ -57,8 +42,6 @@ fn base04_decode_base(b: &mut Bencher) {
5742
let mut spec = Specification::new();
5843
spec.symbols.push_str("0123");
5944
let base = spec.encoding().unwrap();
60-
#[cfg(feature = "v3-preview")]
61-
let base = Encoding::<Bit2, True, False, False, False>::try_from(base).unwrap();
6245
b.iter(|| base.decode_mut(input, output));
6346
}
6447

@@ -69,8 +52,6 @@ fn base08_encode_base(b: &mut Bencher) {
6952
let mut spec = Specification::new();
7053
spec.symbols.push_str("01234567");
7154
let base = spec.encoding().unwrap();
72-
#[cfg(feature = "v3-preview")]
73-
let base = Encoding::<Bit3, True, False, False, False>::try_from(base).unwrap();
7455
b.iter(|| base.encode_mut(input, output));
7556
}
7657

@@ -81,58 +62,56 @@ fn base08_decode_base(b: &mut Bencher) {
8162
let mut spec = Specification::new();
8263
spec.symbols.push_str("01234567");
8364
let base = spec.encoding().unwrap();
84-
#[cfg(feature = "v3-preview")]
85-
let base = Encoding::<Bit3, True, False, False, False>::try_from(base).unwrap();
8665
b.iter(|| base.decode_mut(input, output));
8766
}
8867

8968
#[bench]
9069
fn base16_encode_base(b: &mut Bencher) {
9170
let input = &[0u8; 4096];
9271
let output = &mut [0u8; 8192];
93-
b.iter(|| constants::HEXLOWER.encode_mut(input, output));
72+
b.iter(|| data_encoding::HEXLOWER.encode_mut(input, output));
9473
}
9574

9675
#[bench]
9776
fn base16_decode_base(b: &mut Bencher) {
9877
let input = &[b'0'; 4096];
9978
let output = &mut [0u8; 2048];
100-
b.iter(|| constants::HEXLOWER.decode_mut(input, output));
79+
b.iter(|| data_encoding::HEXLOWER.decode_mut(input, output));
10180
}
10281

10382
#[bench]
10483
fn base32_encode_base(b: &mut Bencher) {
10584
let input = &[0u8; 4096];
10685
let output = &mut [0u8; 6560];
107-
b.iter(|| constants::BASE32.encode_mut(input, output));
86+
b.iter(|| data_encoding::BASE32.encode_mut(input, output));
10887
}
10988

11089
#[bench]
11190
fn base32_decode_base(b: &mut Bencher) {
11291
let input = &[b'A'; 4096];
11392
let output = &mut [0u8; 2560];
114-
b.iter(|| constants::BASE32.decode_mut(input, output));
93+
b.iter(|| data_encoding::BASE32.decode_mut(input, output));
11594
}
11695

11796
#[bench]
11897
fn base64_encode_base(b: &mut Bencher) {
11998
let input = &[0u8; 4096];
12099
let output = &mut [0u8; 5462];
121-
b.iter(|| constants::BASE64_NOPAD.encode_mut(input, output));
100+
b.iter(|| data_encoding::BASE64_NOPAD.encode_mut(input, output));
122101
}
123102

124103
#[bench]
125104
fn base64_decode_base(b: &mut Bencher) {
126105
let input = &[b'A'; 4096];
127106
let output = &mut [0u8; 3072];
128-
b.iter(|| constants::BASE64_NOPAD.decode_mut(input, output));
107+
b.iter(|| data_encoding::BASE64_NOPAD.decode_mut(input, output));
129108
}
130109

131110
#[bench]
132111
fn base64_encode_pad(b: &mut Bencher) {
133112
let input = &mut [b'A'; 4096];
134113
let output = &mut [0u8; 5464];
135-
b.iter(|| constants::BASE64.encode_mut(input, output));
114+
b.iter(|| data_encoding::BASE64.encode_mut(input, output));
136115
}
137116

138117
#[bench]
@@ -146,7 +125,7 @@ fn base64_decode_pad(b: &mut Bencher) {
146125
}
147126
}
148127
let output = &mut [0u8; 3072];
149-
b.iter(|| constants::BASE64.decode_mut(input, output).unwrap());
128+
b.iter(|| data_encoding::BASE64.decode_mut(input, output).unwrap());
150129
}
151130

152131
#[bench]
@@ -157,8 +136,6 @@ fn base64_encode_wrap(b: &mut Bencher) {
157136
spec.wrap.width = 76;
158137
spec.wrap.separator.push_str("\r\n");
159138
let base64 = spec.encoding().unwrap();
160-
#[cfg(feature = "v3-preview")]
161-
let base64 = Encoding::<Bit6, True, True, True, True>::try_from(base64).unwrap();
162139
b.iter(|| base64.encode_mut(input, output));
163140
}
164141

@@ -174,21 +151,19 @@ fn base64_decode_wrap(b: &mut Bencher) {
174151
spec.wrap.width = 76;
175152
spec.wrap.separator.push_str("\r\n");
176153
let base64 = spec.encoding().unwrap();
177-
#[cfg(feature = "v3-preview")]
178-
let base64 = Encoding::<Bit6, True, True, True, True>::try_from(base64).unwrap();
179154
b.iter(|| base64.decode_mut(input, output).unwrap());
180155
}
181156

182157
#[bench]
183158
fn dnscurve_decode_base(b: &mut Bencher) {
184159
let input = &[b'0'; 4096];
185160
let output = &mut [0u8; 2560];
186-
b.iter(|| constants::BASE32_DNSCURVE.decode_mut(input, output));
161+
b.iter(|| data_encoding::BASE32_DNSCURVE.decode_mut(input, output));
187162
}
188163

189164
#[bench]
190165
fn dnscurve_encode_base(b: &mut Bencher) {
191166
let input = &[0u8; 4096];
192167
let output = &mut [0u8; 6554];
193-
b.iter(|| constants::BASE32_DNSCURVE.encode_mut(input, output));
168+
b.iter(|| data_encoding::BASE32_DNSCURVE.encode_mut(input, output));
194169
}

lib/fuzz/Cargo.toml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,3 @@ name = "encode_write"
3030
path = "fuzz_targets/encode_write.rs"
3131
test = false
3232
doc = false
33-
34-
[[bin]]
35-
name = "v3-preview"
36-
path = "fuzz_targets/v3-preview.rs"
37-
test = false
38-
doc = false
39-
required-features = ["data-encoding/v3-preview"]

0 commit comments

Comments
 (0)