Struct tantivy::schema::Term [−][src]
Term represents the value that the token can take.
It actually wraps a Vec<u8>
.
Implementations
impl Term
[src]
pub fn from_field_i64(field: Field, val: i64) -> Term
[src]
Builds a term given a field, and a i64-value
Assuming the term has a field id of 1, and a i64 value of 3234, the Term will have 12 bytes.
The first four byte are dedicated to storing the field id as a u64. The 8 following bytes are encoding the u64 value.
pub fn from_field_f64(field: Field, val: f64) -> Term
[src]
Builds a term given a field, and a f64-value
Assuming the term has a field id of 1, and a f64 value of 1.5, the Term will have 12 bytes.
The first four byte are dedicated to storing the field id as a u64. The 8 following bytes are encoding the f64 as a u64 value.
pub fn from_field_date(field: Field, val: &DateTime) -> Term
[src]
Builds a term given a field, and a DateTime value
Assuming the term has a field id of 1, and a timestamp i64 value of 3234, the Term will have 12 bytes.
The first four byte are dedicated to storing the field id as a u64. The 8 following bytes are encoding the DateTime as i64 timestamp value.
pub fn from_facet(field: Field, facet: &Facet) -> Term
[src]
Creates a Term
given a facet.
pub fn from_field_text(field: Field, text: &str) -> Term
[src]
Builds a term given a field, and a string value
Assuming the term has a field id of 2, and a text value of "abc", the Term will have 4 bytes. The first byte is 2, and the three following bytes are the utf-8 representation of "abc".
pub fn from_field_u64(field: Field, val: u64) -> Term
[src]
Builds a term given a field, and a u64-value
Assuming the term has a field id of 1, and a u64 value of 3234, the Term will have 12 bytes.
The first four byte are dedicated to storing the field id as a u64. The 8 following bytes are encoding the u64 value.
pub fn from_field_bytes(field: Field, bytes: &[u8]) -> Term
[src]
Builds a term bytes.
pub fn set_u64(&mut self, val: u64)
[src]
Sets a u64 value in the term.
U64 are serialized using (8-byte) BigEndian representation. The use of BigEndian has the benefit of preserving the natural order of the values.
pub fn set_i64(&mut self, val: i64)
[src]
Sets a i64
value in the term.
pub fn set_f64(&mut self, val: f64)
[src]
Sets a f64
value in the term.
pub fn set_bytes(&mut self, bytes: &[u8])
[src]
Sets the value of a Bytes
field.
pub fn set_text(&mut self, text: &str)
[src]
Set the texts only, keeping the field untouched.
impl<B> Term<B> where
B: AsRef<[u8]>,
[src]
B: AsRef<[u8]>,
pub fn wrap(data: B) -> Term<B>
[src]
Wraps a object holding bytes
pub fn field(&self) -> Field
[src]
Returns the field.
pub fn get_u64(&self) -> u64
[src]
Returns the u64
value stored in a term.
Panics
... or returns an invalid value
if the term is not a u64
field.
pub fn get_i64(&self) -> i64
[src]
Returns the i64
value stored in a term.
Panics
... or returns an invalid value
if the term is not a i64
field.
pub fn get_f64(&self) -> f64
[src]
Returns the f64
value stored in a term.
Panics
... or returns an invalid value
if the term is not a f64
field.
pub fn text(&self) -> &str
[src]
Returns the text associated with the term.
Panics
If the value is not valid utf-8. This may happen if the index is corrupted or if you try to call this method on a non-string type.
pub fn value_bytes(&self) -> &[u8]ⓘ
[src]
Returns the serialized value of the term. (this does not include the field.)
If the term is a string, its value is utf-8 encoded.
If the term is a u64, its value is encoded according
to byteorder::LittleEndian
.
pub fn as_slice(&self) -> &[u8]ⓘ
[src]
Returns the underlying &[u8]
Trait Implementations
impl<B> AsRef<[u8]> for Term<B> where
B: AsRef<[u8]>,
[src]
B: AsRef<[u8]>,
impl<B: Clone> Clone for Term<B> where
B: AsRef<[u8]>,
[src]
B: AsRef<[u8]>,
impl Debug for Term
[src]
impl<B: Eq> Eq for Term<B> where
B: AsRef<[u8]>,
[src]
B: AsRef<[u8]>,
impl<B: Hash> Hash for Term<B> where
B: AsRef<[u8]>,
[src]
B: AsRef<[u8]>,
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<B: Ord> Ord for Term<B> where
B: AsRef<[u8]>,
[src]
B: AsRef<[u8]>,
fn cmp(&self, other: &Term<B>) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl<B: PartialEq> PartialEq<Term<B>> for Term<B> where
B: AsRef<[u8]>,
[src]
B: AsRef<[u8]>,
impl<B: PartialOrd> PartialOrd<Term<B>> for Term<B> where
B: AsRef<[u8]>,
[src]
B: AsRef<[u8]>,
fn partial_cmp(&self, other: &Term<B>) -> Option<Ordering>
[src]
fn lt(&self, other: &Term<B>) -> bool
[src]
fn le(&self, other: &Term<B>) -> bool
[src]
fn gt(&self, other: &Term<B>) -> bool
[src]
fn ge(&self, other: &Term<B>) -> bool
[src]
impl<B> StructuralEq for Term<B> where
B: AsRef<[u8]>,
[src]
B: AsRef<[u8]>,
impl<B> StructuralPartialEq for Term<B> where
B: AsRef<[u8]>,
[src]
B: AsRef<[u8]>,
Auto Trait Implementations
impl<B> RefUnwindSafe for Term<B> where
B: RefUnwindSafe,
[src]
B: RefUnwindSafe,
impl<B> Send for Term<B> where
B: Send,
[src]
B: Send,
impl<B> Sync for Term<B> where
B: Sync,
[src]
B: Sync,
impl<B> Unpin for Term<B> where
B: Unpin,
[src]
B: Unpin,
impl<B> UnwindSafe for Term<B> where
B: UnwindSafe,
[src]
B: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CallHasher for T where
T: Hash,
T: Hash,
impl<T> Downcast for T where
T: Any,
[src]
T: Any,
pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
[src]
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
[src]
pub fn as_any(&self) -> &(dyn Any + 'static)
[src]
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
[src]
impl<T> DowncastSync for T where
T: Send + Sync + Any,
[src]
T: Send + Sync + Any,
impl<T> From<T> for T
[src]
impl<T> Fruit for T where
T: Send + Downcast,
[src]
T: Send + Downcast,
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,