These are chat archives for rust-lang/rust

26th
Jan 2016
Jan Segre
@jansegre
Jan 26 2016 15:35
I haven't heard of slab before, it could use an arena tag. When I needed I went with typed-arena, it looks solid, though each closure has a different type (all with FnSomething traits), typed-arena or slab wouldn't do. There's also copy_arena, but I doubt closures are Copy so no good. I read on nightly docs that the unstable std::arena::Arena may get deprecated in favor of any-arena (which I haven't found a crate for). Anyway fn-arena may be a good name if that's the primary goal.
Pete Hayes
@petehayes102
Jan 26 2016 17:08
Anyone know if std::hash can be used to generate a hash for a file?
Igor
@target-san
Jan 26 2016 17:13
@petehayes102 https://doc.rust-lang.org/std/hash/trait.Hasher.html Seems to be what you're looking for
Pete Hayes
@petehayes102
Jan 26 2016 17:16
Cheers mate. Do you have any idea how it manages its memory? i.e. if I read in a very large file in chunks and passed each chunk to Hasher, I’m assuming it wouldn’t keep the original chunk in memory?
Igor
@target-san
Jan 26 2016 17:18
Dunno. Though, as I suspect, hasher shouldn't keep buffer itself. It should scan provided buffer, throw its bytes into hash state and then produce final hash value. For different hash implementations, simply check https://crates.io/search?q=hash
Pete Hayes
@petehayes102
Jan 26 2016 17:19
Thanks mate. Appreciate the help.
Kevin K.
@kbknapp
Jan 26 2016 18:13
@petehayes102 if you're trying to do something like hash a file there is https://github.com/DaGenix/rust-crypto
Which looks like it buffers it's input