tazz4843/whisper-rs

How do you think to expose `WhisperState` for users

Closed this issue · 4 comments

Current implementation have WhisperState and this already have Drop interface.
If my understanding is correct, this structure seems ok to expose to user code and we don’t t need to use Key for managing these values. For example: create_key(key: K) -> create_state(): WhisperState<'a> where the 'a <= WhisperContext lifetime.

This interface change would allow users following two points:

  1. User code can just use WhisperState object instead of internal Key.
  2. Can drop internal memory by dropping WhisperState. (Current interface doesn't allow us to drop Whisper's internal memory.)

And also, we can drop our internal Map for mapping key <-> WhisperState (currently, this map takes little bit memories).

If you agree this, I'll send you some patches for aligning code interface as this direction. 🙇

I couldn’t think of a decent way to do it when I originally implemented it. If you have ideas, feel free to make a PR.

OK~! I'll send you a PR about this tonight(in JST)

OK, please see #39 when you have time~!

🎉 #39 so close this issue .