8000 We need to be able to pass more context to the model · Issue #1 · peterbudai/redux · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
8000
We need to be able to pass more context to the model #1
Open
@Yoric

Description

@Yoric

I'm trying to use redux to implement a compression mechanism for sophisticated data structures. For this purpose, I need to be able to pass potentially complex context to the model, not just usize.

For this purpose, I'd need something along the lines of:

/// Values of type `T` contains all the necessary information we need to write to
/// the bit stream. Values are eventually converted to a `usize` for actual writing.
struct Codec<T> where T: Hash + Eq + Into<usize> {
  // ...
}
impl<T> Codec<T> where T: Hash + Eq + Into<usize> {
  fn compress_symbol(&mut self, context: T, output: &mut BitWrite) -> Result<()>;
}

// Similar changes to `Model`.

Instead of the current implementation that hardcodes usize everywhere.

What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0