-
Notifications
You must be signed in to change notification settings - Fork 48
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
recommended method for keeping a Digest
in a struct w/ 3.0 API
#73
Comments
Digest
in a struct w/ 3.0 APIDigest
in a struct w/ 3.0 API
Can pub const CASTAGNOLI: Crc<u32> = Crc::<u32>::new(&CRC_32_ISCSI); Then, Digest will be
|
Oh nice, I didn't think of that at all. I'm happy to make a PR to put an example of that in the docs somewhere. |
Sure, that'd be great. |
@akhilles The Rust docs state that "constants are essentially inlined." Does that mean that by setting |
It will only be evaluated at compile-time and it doesn't matter if it's an associated const. The output of So, if |
Makes sense, thanks! Just wasn't sure what happened under the hood. |
Hello,
I'm trying to make a wrapper for a
std::io::Write
object that keeps a running CRC. This looks something like this:However this is wrong, because the running state of the
digest
gets discarded on every write call (i think). I feel like what I want iscrc.update()
, but it's notpub
. I could also figure out a way to store both thecrc
and thedigest
in the struct, but that would involve internal references, which are a pain to work with.Is there some recommended way to do this? Is this a good case for making
Crc::update
pub?The text was updated successfully, but these errors were encountered: