axiomhq / rust-cuckoofilter

Cuckoo Filter: Practically Better Than Bloom (In Rust)
MIT License
271 stars 38 forks source link

Do not allow return value of CocooFilter::add() to be ignored #11

Closed lukaslueg closed 7 years ago

lukaslueg commented 9 years ago

CocooFilter::add() currently returns false if the item could not be inserted, which is easy to ignore. Such a situation should be considered an error, so the function should probably return values of type Result<(), CocooFilterError> and value Err(CocooFilterError::TableFull) instead of false. Since Result is a #[must_use]-type, the compiler will warn the library's user if a situation where the item was not inserted is not handled.