Skip to content

Commit

Permalink
hex-literal: add documentation (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
newpavlov committed Aug 2, 2020
1 parent 2cb81e3 commit fd86961
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions hex-literal/CHANGELOG.md
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 0.3.1 (2020-08-01)
### Added
- Documentation for the `hex!` macro ([#73])

[#73]: https://github.com/RustCrypto/utils/pull/73

## 0.3.0 (2020-07-16)
### Changed
- MSRV bump to 1.45 ([#53])
Expand Down
2 changes: 1 addition & 1 deletion hex-literal/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "hex-literal"
version = "0.3.0"
version = "0.3.1"
authors = ["RustCrypto Developers"]
license = "MIT OR Apache-2.0"
description = "Procedural macro for converting hexadecimal string to byte array at compile time."
Expand Down
4 changes: 3 additions & 1 deletion hex-literal/src/lib.rs
Expand Up @@ -90,7 +90,7 @@ impl TokenTreeIter {
b'A'..=b'F' => v - 55,
b'a'..=b'f' => v - 87,
b' ' | b'\r' | b'\n' | b'\t' => continue,
_ => panic!("invalid character"),
_ => panic!("encountered invalid character"),
};
return Some(n);
}
Expand All @@ -117,6 +117,8 @@ impl Iterator for TokenTreeIter {
}
}

/// Macro for converting string literal containing hex-encoded string
/// to an array containing decoded bytes
#[proc_macro]
pub fn hex(input: TokenStream) -> TokenStream {
let ts = TokenStream::from_iter(TokenTreeIter::new(input));
Expand Down

0 comments on commit fd86961

Please sign in to comment.