Vendor dependencies for 0.3.0 release

This commit is contained in:
2025-09-27 10:29:08 -05:00
parent 0c8d39d483
commit 82ab7f317b
26803 changed files with 16134934 additions and 0 deletions

View File

@@ -0,0 +1 @@
{"files":{"Cargo.toml":"15665889575d7562802e6d87a9dd03ba979d3f9099f3a7437c29d25d349e882f","LICENSE":"6597097f2ed0a4e4211501275ec991ed11e2412476e199b8a9f467b9933ffa46","README.md":"dd84607e87c62e3d24101518f480fbeb1b5541e20a5311e83fb79eee5bc2d707","src/lib.rs":"b3bc95723f7637de8ea124832385a987792710cbcfc04a4564722293f020b277"},"package":"32b13ea120a812beba79e34316b3942a857c86ec1593cb34f27bb28272ce2cca"}

20
vendor/const-fnv1a-hash/Cargo.toml vendored Normal file
View File

@@ -0,0 +1,20 @@
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
#
# When uploading crates to the registry Cargo will automatically
# "normalize" Cargo.toml files for maximal compatibility
# with all versions of Cargo and also rewrite `path` dependencies
# to registry (e.g., crates.io) dependencies.
#
# If you are reading this file be aware that the original Cargo.toml
# will likely look very different (and much more reasonable).
# See Cargo.toml.orig for the original contents.
[package]
edition = "2018"
name = "const-fnv1a-hash"
version = "1.1.0"
description = "A #![no_std] crate for performing FNV1A-16/32/64/128 hashing on Rust stable at compile time."
homepage = "https://github.com/HindrikStegenga/const-fnv1a-hash"
readme = "README.md"
license = "MIT"
repository = "https://github.com/HindrikStegenga/const-fnv1a-hash"

21
vendor/const-fnv1a-hash/LICENSE vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 Hindrik Stegenga
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

11
vendor/const-fnv1a-hash/README.md vendored Normal file
View File

@@ -0,0 +1,11 @@
# const-fnv1a-hash
Rust based const FNV1A hashing implementation for hashing at compile time.
This is a Rust implementation of FNV1A hashing algorithms which works on the stable channel.
# Features
- no_std.
- All functions are const, and can be used at compile time to hash all the things.
- Additional convenience functions for str hashing.
- dependency free.
- 16 bit hashing implemented using XOR folding.

102
vendor/const-fnv1a-hash/src/lib.rs vendored Normal file
View File

@@ -0,0 +1,102 @@
#![no_std]
const FNV_OFFSET_BASIS_32: u32 = 0x811c9dc5;
const FNV_OFFSET_BASIS_64: u64 = 0xcbf29ce484222325;
const FNV_OFFSET_BASIS_128: u128 = 0x6c62272e07bb014262b821756295c58d;
const FNV_PRIME_32: u32 = 0x01000193;
const FNV_PRIME_64: u64 = 0x00000100000001B3;
const FNV_PRIME_128: u128 = 0x0000000001000000000000000000013B;
macro_rules! fnv_hash_impl {
($typ:ty, $size:literal, $fn_name:ident, $str_fn_name:ident, $offset:expr, $prime:expr) => {
#[doc = concat![
"Computes ",
stringify!($size),
"-bits fnv1a hash of the given slice, or up-to limit if provided. ",
"If limit is zero or exceeds slice length, slice length is used instead.",
]]
pub const fn $fn_name(bytes: &[u8], limit: Option<usize>) -> $typ {
let prime = $prime;
let mut hash = $offset;
let mut i = 0;
let len = match limit {
Some(v) if 0 < v && v <= bytes.len() => {
v
},
_ => {
bytes.len()
}
};
while i < len {
hash ^= bytes[i] as $typ;
hash = hash.wrapping_mul(prime);
i += 1;
}
hash
}
#[doc = concat![
"Computes ",
stringify!($size),
"-bit fnv1a hash from a str."
]]
#[inline(always)]
pub const fn $str_fn_name(input: &str) -> $typ {
$fn_name(input.as_bytes(), None)
}
}
}
fnv_hash_impl!{u32, 32, fnv1a_hash_32, fnv1a_hash_str_32, FNV_OFFSET_BASIS_32, FNV_PRIME_32}
fnv_hash_impl!{u64, 64, fnv1a_hash_64, fnv1a_hash_str_64, FNV_OFFSET_BASIS_64, FNV_PRIME_64}
fnv_hash_impl!{u128, 128, fnv1a_hash_128, fnv1a_hash_str_128, FNV_OFFSET_BASIS_128, FNV_PRIME_128}
/// Computes 32-bits fnv1a hash and XORs higher and lower 16-bits.
/// This results in a 16-bits hash value.
/// Up to limit if provided, otherwise slice length.
/// If limit is zero or exceeds slice length, slice length is used instead.
#[inline(always)]
pub const fn fnv1a_hash_16_xor(bytes: &[u8], limit: Option<usize>) -> u16 {
let bytes = fnv1a_hash_32(bytes, limit).to_ne_bytes();
let upper: u16 = u16::from_ne_bytes([bytes[0], bytes[1]]);
let lower: u16 = u16::from_ne_bytes([bytes[2], bytes[3]]);
upper ^ lower
}
/// Computes 16-bit fnv1a hash from a str using XOR folding.
#[inline(always)]
pub const fn fnv1a_hash_str_16_xor(input: &str) -> u16 {
fnv1a_hash_16_xor(input.as_bytes(), None)
}
#[cfg(test)]
mod tests {
use super::*;
fn test_hash<T: Eq + core::fmt::Debug>(hash_func: impl FnOnce(&str) -> T, source_str: &str, expected: T) {
let hashed = hash_func(source_str);
let bit_size = core::mem::size_of::<T>() * 8;
assert_eq!(hashed, expected, "fnv1a-{bit_size} hash for {source_str}")
}
const FOOBAR: &str = "foobar";
const FOOBAR_HASH_32: u32 = 0xbf9cf968;
const FOOBAR_HASH_64: u64 = 0x85944171f73967e8;
const FOOBAR_HASH_128: u128 = 0x343e1662793c64bf6f0d3597ba446f18;
#[test]
fn test_32() {
test_hash(fnv1a_hash_str_32, FOOBAR, FOOBAR_HASH_32)
}
#[test]
fn test_64() {
test_hash(fnv1a_hash_str_64, FOOBAR, FOOBAR_HASH_64)
}
#[test]
fn test_128() {
test_hash(fnv1a_hash_str_128, FOOBAR, FOOBAR_HASH_128)
}
}