Skip to content

Commit

Permalink
Add no_std to the crate
Browse files Browse the repository at this point in the history
  • Loading branch information
mina86 committed Feb 4, 2022
1 parent 7226973 commit 4082f37
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "ansi_colours"
description = "true-colour ↔ ANSI terminal palette converter"
version = "1.1.0"
version = "1.1.1"
readme = "README.md"
authors = ["Michał Nazarewicz <mina86@mina86.com>"]
keywords = ["ansi", "terminal", "color", "rgb"]
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@
//! }
//! ```
#![no_std]

pub(crate) mod ansi256;
#[cfg(test)]
mod test;
Expand Down
9 changes: 6 additions & 3 deletions src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,13 @@ fn test_to_ansi_approx() {
/// purpose simply update the checksum in this test.
#[test]
fn from_rgb_checksum() {
let mut vec = Vec::with_capacity(1 << 24);
let mut buf = [0; 1 << 12];
let mut checksum = 0;
for rgb in 0..(1 << 24) {
vec.push(crate::ansi256_from_rgb(rgb));
buf[rgb % buf.len()] = crate::ansi256_from_rgb(rgb as u32);
if rgb % buf.len() == buf.len() - 1 {
checksum = crc64::crc64(checksum, &buf);
}
}
let checksum = crc64::crc64(0, vec.as_slice());
assert_eq!(3373856917329536106, checksum);
}

0 comments on commit 4082f37

Please sign in to comment.