Enum Value

Source
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

Source

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).

Source

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).

Source

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.)

Source

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)

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Source§

fn serialize<W: Write>(&self, writer: &mut W) -> Result<()>

Serialize
Source§

fn deserialize<R: Read>(reader: &mut R) -> Result<Self>

Deserialize
Source§

impl Clone for Value

Source§

fn clone(&self) -> Value

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Value

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Value

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<'a> From<&'a [u8]> for Value

Source§

fn from(bytes: &'a [u8]) -> Value

Converts to this type from the input type.
Source§

impl<'a> From<&'a str> for Value

Source§

fn from(s: &'a str) -> Value

Converts to this type from the input type.
Source§

impl From<DateTime> for Value

Source§

fn from(dt: DateTime) -> Value

Converts to this type from the input type.
Source§

impl From<Facet> for Value

Source§

fn from(facet: Facet) -> Value

Converts to this type from the input type.
Source§

impl From<FieldValue> for Value

Source§

fn from(field_value: FieldValue) -> Self

Converts to this type from the input type.
Source§

impl From<Ipv6Addr> for Value

Source§

fn from(v: Ipv6Addr) -> Value

Converts to this type from the input type.
Source§

impl From<Map<String, Value>> for Value

Source§

fn from(json_object: Map<String, Value>) -> Value

Converts to this type from the input type.
Source§

impl From<PreTokenizedString> for Value

Source§

fn from(pretokenized_string: PreTokenizedString) -> Value

Converts to this type from the input type.
Source§

impl From<String> for Value

Source§

fn from(s: String) -> Value

Converts to this type from the input type.
Source§

impl From<Value> for Value

Source§

fn from(json_value: Value) -> Value

Converts to this type from the input type.
Source§

impl From<Vec<u8>> for Value

Source§

fn from(bytes: Vec<u8>) -> Value

Converts to this type from the input type.
Source§

impl From<bool> for Value

Source§

fn from(b: bool) -> Self

Converts to this type from the input type.
Source§

impl From<f64> for Value

Source§

fn from(v: f64) -> Value

Converts to this type from the input type.
Source§

impl From<i64> for Value

Source§

fn from(v: i64) -> Value

Converts to this type from the input type.
Source§

impl From<u64> for Value

Source§

fn from(v: u64) -> Value

Converts to this type from the input type.
Source§

impl PartialEq for Value

Source§

fn eq(&self, other: &Value) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Value

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for Value

Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

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.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert 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)

Convert &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)

Convert &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
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> Fruit for T
where T: Send + Downcast,