add From impl to BoxTokenStream, Bump tokenizer-api version

This commit is contained in:
Pascal Seitz
2023-06-23 16:39:31 +08:00
parent 8199aa7de7
commit 4f2e810b83
2 changed files with 7 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
[package]
name = "tantivy-tokenizer-api"
version = "0.1.0"
version = "0.1.1"
license = "MIT"
edition = "2021"
description = "Tokenizer API of tantivy"

View File

@@ -63,6 +63,12 @@ pub trait Tokenizer: 'static + Clone + Send + Sync {
/// Simple wrapper of `Box<dyn TokenStream + 'a>`.
pub struct BoxTokenStream<'a>(Box<dyn TokenStream + 'a>);
impl<'a> From<BoxTokenStream<'a>> for Box<dyn TokenStream + 'a> {
fn from(token_stream: BoxTokenStream<'a>) -> Self {
token_stream.0
}
}
impl<'a, T> From<T> for BoxTokenStream<'a>
where T: TokenStream + 'a
{