pub struct Expression {
pub variant: Option<Variant>,
}Fields§
§variant: Option<Variant>Implementations§
Source§impl Expression
impl Expression
Sourcepub fn variable<S: Into<String>>(name: S) -> Self
pub fn variable<S: Into<String>>(name: S) -> Self
Creates a new Expression with a variable (payload key or reference to score).
Sourcepub fn score_idx(idx: usize) -> Self
pub fn score_idx(idx: usize) -> Self
Creates a new Expression with a reference to the score of a specific prefetch, when there are multiple prefetches.
Sourcepub fn condition<C: Into<Condition>>(condition: C) -> Self
pub fn condition<C: Into<Condition>>(condition: C) -> Self
Creates a new Expression with a condition. If true, becomes 1.0; otherwise 0.0.
Sourcepub fn geo_distance<G: Into<GeoDistance>>(geo_distance: G) -> Self
pub fn geo_distance<G: Into<GeoDistance>>(geo_distance: G) -> Self
Creates a new Expression with a geographic distance in meters.
Sourcepub fn datetime<S: Into<String>>(datetime: S) -> Self
pub fn datetime<S: Into<String>>(datetime: S) -> Self
Creates a new Expression with a date-time constant.
Sourcepub fn datetime_key<S: Into<String>>(key: S) -> Self
pub fn datetime_key<S: Into<String>>(key: S) -> Self
Creates a new Expression with a payload key with date-time values.
Sourcepub fn mult<M: Into<MultExpression>>(mult: M) -> Self
pub fn mult<M: Into<MultExpression>>(mult: M) -> Self
Creates a new Expression with a multiplication expression.
Sourcepub fn sum<S: Into<SumExpression>>(sum: S) -> Self
pub fn sum<S: Into<SumExpression>>(sum: S) -> Self
Creates a new Expression with a sum expression.
Sourcepub fn div<D: Into<DivExpression>>(div: D) -> Self
pub fn div<D: Into<DivExpression>>(div: D) -> Self
Creates a new Expression with a division expression.
Sourcepub fn neg<E: Into<Expression>>(expr: E) -> Self
pub fn neg<E: Into<Expression>>(expr: E) -> Self
Creates a new Expression with a negation expression.
Sourcepub fn abs<E: Into<Expression>>(expr: E) -> Self
pub fn abs<E: Into<Expression>>(expr: E) -> Self
Creates a new Expression with an absolute value expression.
Sourcepub fn sqrt<E: Into<Expression>>(expr: E) -> Self
pub fn sqrt<E: Into<Expression>>(expr: E) -> Self
Creates a new Expression with a square root expression.
Sourcepub fn pow<P: Into<PowExpression>>(pow: P) -> Self
pub fn pow<P: Into<PowExpression>>(pow: P) -> Self
Creates a new Expression with a power expression.
Sourcepub fn exp<E: Into<Expression>>(expr: E) -> Self
pub fn exp<E: Into<Expression>>(expr: E) -> Self
Creates a new Expression with an exponential expression.
Sourcepub fn log10<E: Into<Expression>>(expr: E) -> Self
pub fn log10<E: Into<Expression>>(expr: E) -> Self
Creates a new Expression with a log10 expression.
Sourcepub fn ln<E: Into<Expression>>(expr: E) -> Self
pub fn ln<E: Into<Expression>>(expr: E) -> Self
Creates a new Expression with a natural logarithm expression.
Sourcepub fn geo_distance_with<G: Into<GeoPoint>, S: Into<String>>(
origin: G,
to: S,
) -> Self
pub fn geo_distance_with<G: Into<GeoPoint>, S: Into<String>>( origin: G, to: S, ) -> Self
Creates a new Expression with a geo distance expression.
Sourcepub fn exp_decay<D: Into<DecayParamsExpression>>(decay: D) -> Self
pub fn exp_decay<D: Into<DecayParamsExpression>>(decay: D) -> Self
Creates a new Expression with an exponential decay expression.
Sourcepub fn gauss_decay<D: Into<DecayParamsExpression>>(decay: D) -> Self
pub fn gauss_decay<D: Into<DecayParamsExpression>>(decay: D) -> Self
Creates a new Expression with a Gaussian decay expression.
Sourcepub fn lin_decay<D: Into<DecayParamsExpression>>(decay: D) -> Self
pub fn lin_decay<D: Into<DecayParamsExpression>>(decay: D) -> Self
Creates a new Expression with a linear decay expression.
Sourcepub fn mult_with<E: Into<Expression>, I: IntoIterator<Item = E>>(
expressions: I,
) -> Self
pub fn mult_with<E: Into<Expression>, I: IntoIterator<Item = E>>( expressions: I, ) -> Self
Helper method to create a multiplication expression with multiple sub-expressions.
Sourcepub fn sum_with<E: Into<Expression>, I: IntoIterator<Item = E>>(
expressions: I,
) -> Self
pub fn sum_with<E: Into<Expression>, I: IntoIterator<Item = E>>( expressions: I, ) -> Self
Helper method to create a sum expression with multiple sub-expressions.
Sourcepub fn div_with<L: Into<Expression>, R: Into<Expression>>(
left: L,
right: R,
by_zero_default: Option<f32>,
) -> Self
pub fn div_with<L: Into<Expression>, R: Into<Expression>>( left: L, right: R, by_zero_default: Option<f32>, ) -> Self
Helper method to create a division expression with left and right operands.
Sourcepub fn pow_with<B: Into<Expression>, E: Into<Expression>>(
base: B,
exponent: E,
) -> Self
pub fn pow_with<B: Into<Expression>, E: Into<Expression>>( base: B, exponent: E, ) -> Self
Helper method to create a power expression with base and exponent.
Trait Implementations§
Source§impl Clone for Expression
impl Clone for Expression
Source§fn clone(&self) -> Expression
fn clone(&self) -> Expression
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Expression
impl Debug for Expression
Source§impl Default for Expression
impl Default for Expression
Source§impl From<Condition> for Expression
impl From<Condition> for Expression
Source§impl From<DivExpression> for Expression
impl From<DivExpression> for Expression
Source§fn from(value: DivExpression) -> Self
fn from(value: DivExpression) -> Self
Source§impl From<GeoDistance> for Expression
impl From<GeoDistance> for Expression
Source§fn from(value: GeoDistance) -> Self
fn from(value: GeoDistance) -> Self
Source§impl From<MultExpression> for Expression
impl From<MultExpression> for Expression
Source§fn from(value: MultExpression) -> Self
fn from(value: MultExpression) -> Self
Source§impl From<PowExpression> for Expression
impl From<PowExpression> for Expression
Source§fn from(value: PowExpression) -> Self
fn from(value: PowExpression) -> Self
Source§impl From<String> for Expression
impl From<String> for Expression
Source§impl From<SumExpression> for Expression
impl From<SumExpression> for Expression
Source§fn from(value: SumExpression) -> Self
fn from(value: SumExpression) -> Self
Source§impl From<f32> for Expression
impl From<f32> for Expression
Source§impl Message for Expression
impl Message for Expression
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self. Read moreSource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self.Source§impl PartialEq for Expression
impl PartialEq for Expression
impl StructuralPartialEq for Expression
Auto Trait Implementations§
impl Freeze for Expression
impl RefUnwindSafe for Expression
impl Send for Expression
impl Sync for Expression
impl Unpin for Expression
impl UnwindSafe for Expression
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request