Skip to content

Commit

Permalink
Merge pull request #30 from eval-exec/exec/bump-0.8.0
Browse files Browse the repository at this point in the history
Bump version to `0.8.0`, Update `README.md` and `CHANGELOG.md`
  • Loading branch information
zhangsoledad authored Jun 19, 2023
2 parents a4c06b3 + a1fc74b commit 7ae3424
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

name: RocksDB CI
name: nervosnetwork/faster-hex CI

on: [push, pull_request]

Expand Down
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
# [0.6.1](https://github.com/nervosnetwork/faster-hex/compare/v0.5.0...v0.6.1) (2021-08-31)
# [0.8.0](https://github.com/nervosnetwork/faster-hex/compare/v0.7.0...v0.8.0) (2023-02-27)

### Features

* Add serde feature for faster-hex ([pr#28](https://github.com/nervosnetwork/faster-hex/pull/28))

# [0.7.0](https://github.com/nervosnetwork/faster-hex/compare/v0.6.1...v0.7.0) (2023-02-27)

### Features

* Allow faster-hex encode/decode to/from lower/uppercase ([pr#26](https://github.com/nervosnetwork/faster-hex/pull/26))
### Bug Fixes
* Improve encode/decode length check ([pr#27](https://github.com/nervosnetwork/faster-hex/pull/27))

### Features

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "faster-hex"
version = "0.7.0"
version = "0.8.0"
authors = ["zhangsoledad <787953403@qq.com>"]
edition = "2018"
keywords = ["simd", "hex", "no-std"]
Expand Down
56 changes: 56 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,62 @@ Compare with [rustc-hex](https://crates.io/crates/rustc-hex):
* Encoding ~2.5x over
* Decoding ~7x over

## Examples
Encode to hex

```rust
use faster_hex::hex_string;

let result = hex_string(b"Hello world!");
assert_eq!(result, "48656c6c6f20776f726c6421");
```
Encode to upper case hex
```rust
use faster_hex::hex_string_upper;

let result = hex_string_upper(b"Hello world!");
assert_eq!(result, "48656C6C6F20776F726C6421");
```

Decode
```rust
use faster_hex::hex_decode;

let src = b"48656c6c6f20776f726c6421";
let mut dst = vec![0; src.len() / 2];
hex_decode(src, &mut dst).unwrap();
assert_eq!(dst, b"Hello world!");
```
Decode with case check
```rust
use faster_hex::{hex_decode_with_case, CheckCase};

let src = b"48656c6c6f20776f726c6421";
let mut dst = vec![0; src.len() / 2];

assert!(hex_decode_with_case(src, &mut dst, CheckCase::Lower).is_ok());
assert_eq!(dst, b"Hello world!");

assert!(hex_decode_with_case(src, &mut dst, CheckCase::None).is_ok());
assert_eq!(dst, b"Hello world!");

assert!(hex_decode_with_case(src, &mut dst, CheckCase::Upper).is_err());
```

Serde feature
```rust

use serde::{Deserialize, Serialize};

#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
struct Simple {
#[serde(with = "faster_hex")]
foo: Vec<u8>,
#[serde(with = "faster_hex::nopfx_lowercase")]
bar: Vec<u8>,
}
```


## Notice

Expand Down

0 comments on commit 7ae3424

Please sign in to comment.