precomputed-hash-0.1.1/.gitignore01006440001750000175000000000036131635254040015174 0ustar0000000000000000target/ **/*.rs.bk Cargo.lock precomputed-hash-0.1.1/Cargo.toml.orig01006440001750000175000000000440131635260730016075 0ustar0000000000000000[package] name = "precomputed-hash" version = "0.1.1" authors = ["Emilio Cobos Álvarez "] license = "MIT" repository = "https://github.com/emilio/precomputed-hash" description = "A library intending to be a base dependency to expose a precomputed hash" [dependencies] precomputed-hash-0.1.1/Cargo.toml0000644000000014540011324 0ustar00# 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 believe there's an error in this file please file an # issue against the rust-lang/cargo repository. If you're # editing this file be aware that the upstream Cargo.toml # will likely look very different (and much more reasonable) [package] name = "precomputed-hash" version = "0.1.1" authors = ["Emilio Cobos Álvarez "] description = "A library intending to be a base dependency to expose a precomputed hash" license = "MIT" repository = "https://github.com/emilio/precomputed-hash" [dependencies] precomputed-hash-0.1.1/LICENSE01006440001750000175000000002066131635254040014216 0ustar0000000000000000MIT License Copyright (c) 2017 Emilio Cobos Álvarez 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. precomputed-hash-0.1.1/src/lib.rs01006440001750000175000000001203131635256000015102 0ustar0000000000000000//! A base trait to expose a precomputed hash for a type. /// A trait to expose a precomputed hash for a type. pub trait PrecomputedHash { // TODO(emilio): Perhaps an associated type would be on point here. /// Return the precomputed hash for this item. fn precomputed_hash(&self) -> u32; } // These are equivalent to the `std::Hash` impls. impl<'a, T: PrecomputedHash> PrecomputedHash for &'a T { fn precomputed_hash(&self) -> u32 { (**self).precomputed_hash() } } impl<'a, T: PrecomputedHash> PrecomputedHash for &'a mut T { fn precomputed_hash(&self) -> u32 { (**self).precomputed_hash() } }