GithubHelp home page GithubHelp logo

associative-cache's People

Contributors

ahrens avatar dependabot-preview[bot] avatar fitzgen avatar matklad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

associative-cache's Issues

Tests fail on 32-bit architectures

When running tests for 1.0.1 on i386, I get the following failures:

$ /usr/bin/cargo test -j12 -Z avoid-dev-deps --release --no-fail-fast --lib
running 15 tests
test replacement::lru::tests::lru_replacement ... ok
test indices::tests::pointer_two_way ... FAILED
test indices::tests::pointer_direct_mapped ... FAILED
test tests::entry ... ok
test tests::get ... ok
test tests::get_mut ... ok
test tests::capacity ... ok
test tests::insert ... ok
test tests::iter ... ok
test tests::into_iter ... ok
test tests::iter_mut ... ok
test tests::len ... ok
test tests::replacement_policy ... ok
test tests::retain ... ok
test tests::remove ... ok

failures:

---- indices::tests::pointer_two_way stdout ----
thread 'indices::tests::pointer_two_way' panicked at 'assertion failed: `(left == right)`
  left: `0..2`,
 right: `2..4`', src/indices.rs:185:9

---- indices::tests::pointer_direct_mapped stdout ----
thread 'indices::tests::pointer_direct_mapped' panicked at 'assertion failed: `(left == right)`
  left: `2..3`,
 right: `1..2`', src/indices.rs:161:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
    indices::tests::pointer_direct_mapped
    indices::tests::pointer_two_way

test result: FAILED. 13 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

error: test failed, to rerun pass `--lib`
error: 1 target failed:
    `--lib`

Time complexities?

Hi, I was looking for something exactly like your crate for a class project. The only thing that I was wondering was the (amortized) time complexity of get, get_mut, insert, and remove? Is there significant overhead to using this associative cache over a regular hash map?

Include the license texts

This crate claims that its license is MIT OR Apache-2.0, but the license text is not included. Both the MIT and the Apache-2.0 licenses require including the full text when distributing the software, so users cannot comply with that license if you don't include it. Please add the license text.

`LruTimestamp::get_timestamp()` can't compute result

context:

pub trait LruTimestamp {
    type Timestamp: PartialOrd;
    fn get_timestamp(&self) -> &Self::Timestamp;
}

I think this means LruTimestamp::get_timestamp() has to return a reference to something inside self, so it can't compute the timestamp. For example, if I want the timestamp to be self.member1 + self.member2. Or in my case, self is #[repr(packed)], so I can't[*] return a reference to a member; I want to do the unaligned dereference and return the value.

[*] or at least, rustc says it will be disallowed in a future release

I think that the interface could be changed to:

pub trait LruTimestamp {
    type Timestamp: PartialOrd;
    fn get_timestamp(&self) -> Self::Timestamp; // removed &
}

And then you can still return a reference to something inside self when desired, by defining the Timestamp type to be a reference, e.g.:

impl<T> LruTimestamp for WithLruTimestamp<T> {
    type Timestamp = &Cell<Instant>; // added &
    fn get_timestamp(&self) -> Self::Timestamp { // removed &
        &self.timestamp
    }
}

I'm not sure exactly how to do this as a non-breaking change, maybe add a new trait, LruTimestampByValue?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.