pub enum Value {
Str(String),
PreTokStr(PreTokenizedString),
U64(u64),
I64(i64),
F64(f64),
Date(DateTime),
Facet(Facet),
Bytes(Vec<u8>),
JsonObject(Map<String, Value>),
}
Expand description
Value represents the value of a any field. It is an enum over all over all of the possible field type.
Variants
Str(String)
The str type is used for any text information.
PreTokStr(PreTokenizedString)
Pre-tokenized str type,
U64(u64)
Unsigned 64-bits Integer u64
I64(i64)
Signed 64-bits Integer i64
F64(f64)
64-bits Float f64
Date(DateTime)
Date/time with second precision
Facet(Facet)
Facet
Bytes(Vec<u8>)
Arbitrarily sized byte array
JsonObject(Map<String, Value>)
Json object value.
Implementations
sourceimpl Value
impl Value
sourcepub fn as_text(&self) -> Option<&str>
pub fn as_text(&self) -> Option<&str>
Returns the text value, provided the value is of the Str
type.
(Returns None if the value is not of the Str
type).
sourcepub fn as_facet(&self) -> Option<&Facet>
pub fn as_facet(&self) -> Option<&Facet>
Returns the facet value, provided the value is of the Facet
type.
(Returns None if the value is not of the Facet
type).
sourcepub fn tokenized_text(&self) -> Option<&PreTokenizedString>
pub fn tokenized_text(&self) -> Option<&PreTokenizedString>
Returns the tokenized text, provided the value is of the PreTokStr
type.
(Returns None if the value is not of the PreTokStr
type.)
sourcepub fn as_u64(&self) -> Option<u64>
pub fn as_u64(&self) -> Option<u64>
Returns the u64-value, provided the value is of the U64
type.
(Returns None if the value is not of the U64
type)
sourcepub fn as_i64(&self) -> Option<i64>
pub fn as_i64(&self) -> Option<i64>
Returns the i64-value, provided the value is of the I64
type.
Return None if the value is not of type I64
.
sourcepub fn as_f64(&self) -> Option<f64>
pub fn as_f64(&self) -> Option<f64>
Returns the f64-value, provided the value is of the F64
type.
Return None if the value is not of type F64
.
sourcepub fn as_date(&self) -> Option<DateTime>
pub fn as_date(&self) -> Option<DateTime>
Returns the Date-value, provided the value is of the Date
type.
Returns None if the value is not of type Date
.
Trait Implementations
sourceimpl BinarySerializable for Value
impl BinarySerializable for Value
sourceimpl<'de> Deserialize<'de> for Value
impl<'de> Deserialize<'de> for Value
sourcefn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl From<FieldValue> for Value
impl From<FieldValue> for Value
sourcefn from(field_value: FieldValue) -> Self
fn from(field_value: FieldValue) -> Self
Converts to this type from the input type.
sourceimpl From<PreTokenizedString> for Value
impl From<PreTokenizedString> for Value
sourcefn from(pretokenized_string: PreTokenizedString) -> Value
fn from(pretokenized_string: PreTokenizedString) -> Value
Converts to this type from the input type.
impl Eq for Value
impl StructuralPartialEq for Value
Auto Trait Implementations
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnwindSafe for Value
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
sourcefn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
sourcefn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
sourcefn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
sourcefn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more
sourceimpl<T> DowncastSync for T where
T: Any + Send + Sync,
impl<T> DowncastSync for T where
T: Any + Send + Sync,
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more