messense / jieba-rs

The Jieba Chinese Word Segmentation Implemented in Rust
MIT License
738 stars 46 forks source link

能否增加返回Iterator接口? #80

Closed wyhhh closed 3 years ago

wyhhh commented 3 years ago

像常用的cut_xx接口,都是返回的Vec,但实际上是不必要alloc的。所以我建议增加或改动返回Iterator,减少alloc,提高性能

messense commented 3 years ago

当然可以,不过 stable Rust 还没有能用的类似 Python iterator 的 yield 的机制,改成 Iterator 会比较复杂。

wyhhh commented 3 years ago

没事,我先魔改下cut