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

hex-literal: add documentation #73

Merged
merged 1 commit into from Aug 2, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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