Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump version to 0.8.0, Update README.md and CHANGELOG.md #30

Merged
merged 3 commits into from
Jun 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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