tantivy-py/src/schema.rs

29 lines
634 B
Rust
Raw Normal View History

use pyo3::{basic::CompareOp, prelude::*};
2019-08-02 11:23:10 +00:00
use tantivy as tv;
/// Tantivy schema.
///
/// The schema is very strict. To build the schema the `SchemaBuilder` class is
/// provided.
#[pyclass(frozen)]
#[derive(PartialEq)]
pub(crate) struct Schema {
2019-08-02 11:23:10 +00:00
pub(crate) inner: tv::schema::Schema,
}
#[pymethods]
impl Schema {
fn __richcmp__(
&self,
other: &Self,
op: CompareOp,
py: Python<'_>,
) -> PyObject {
match op {
CompareOp::Eq => (self == other).into_py(py),
CompareOp::Ne => (self != other).into_py(py),
_ => py.NotImplemented(),
}
}
}