pub enum Value {
Str(String),
PreTokStr(PreTokenizedString),
U64(u64),
I64(i64),
F64(f64),
Bool(bool),
Date(DateTime),
Facet(Facet),
Bytes(Vec<u8>),
JsonObject(Map<String, Value>),
IpAddr(Ipv6Addr),
}
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
Bool(bool)
Bool value
Date(DateTime)
Date/time with microseconds precision
Facet(Facet)
Facet
Bytes(Vec<u8>)
Arbitrarily sized byte array
JsonObject(Map<String, Value>)
Json object value.
IpAddr(Ipv6Addr)
IpV6 Address. Internally there is no IpV4, it needs to be converted to Ipv6Addr
.
Implementations§
Source§impl 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.
Returns 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.
Returns None
if the value is not of type F64
.
Sourcepub fn as_bool(&self) -> Option<bool>
pub fn as_bool(&self) -> Option<bool>
Returns the bool value, provided the value is of the Bool
type.
Returns None
if the value is not of type Bool
.
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
.
Sourcepub fn as_bytes(&self) -> Option<&[u8]>
pub fn as_bytes(&self) -> Option<&[u8]>
Returns the Bytes-value, provided the value is of the Bytes
type.
Returns None
if the value is not of type Bytes
.
Sourcepub fn as_json(&self) -> Option<&Map<String, Value>>
pub fn as_json(&self) -> Option<&Map<String, Value>>
Returns the json object, provided the value is of the JsonObject
type.
Returns None
if the value is not of type JsonObject
.
Sourcepub fn as_ip_addr(&self) -> Option<Ipv6Addr>
pub fn as_ip_addr(&self) -> Option<Ipv6Addr>
Returns the ip addr, provided the value is of the Ip
type.
(Returns None if the value is not of the Ip
type)
Trait Implementations§
Source§impl BinarySerializable for Value
impl BinarySerializable for Value
Source§impl<'de> Deserialize<'de> for Value
impl<'de> Deserialize<'de> for Value
Source§fn 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>,
Source§impl From<FieldValue> for Value
impl From<FieldValue> for Value
Source§fn from(field_value: FieldValue) -> Self
fn from(field_value: FieldValue) -> Self
Source§impl From<PreTokenizedString> for Value
impl From<PreTokenizedString> for Value
Source§fn from(pretokenized_string: PreTokenizedString) -> Value
fn from(pretokenized_string: PreTokenizedString) -> Value
impl Eq for Value
impl StructuralPartialEq for Value
Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnwindSafe for Value
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more