pub struct FuseProperty {
pub value: String,
pub weight: f64,
}
Expand description
Defines the fuseproperty object to be returned as part of the list returned by properties() implemented by the Fuseable trait.
§Examples:
Basic Usage:
use fuse_rust::{ Fuse, Fuseable, FuseProperty };
struct Book<'a> {
title: &'a str,
author: &'a str,
}
impl Fuseable for Book<'_>{
fn properties(&self) -> Vec<FuseProperty> {
return vec!(
FuseProperty{value: String::from("title"), weight: 0.3},
FuseProperty{value: String::from("author"), weight: 0.7},
)
}
fn lookup(&self, key: &str) -> Option<&str> {
return match key {
"title" => Some(self.title),
"author" => Some(self.author),
_ => None
}
}
}
Fields§
§value: String
The name of the field with an associated weight in the search.
weight: f64
The weight associated with the specified field.
Implementations§
Source§impl FuseProperty
impl FuseProperty
Auto Trait Implementations§
impl Freeze for FuseProperty
impl RefUnwindSafe for FuseProperty
impl Send for FuseProperty
impl Sync for FuseProperty
impl Unpin for FuseProperty
impl UnwindSafe for FuseProperty
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
Mutably borrows from an owned value. Read more
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>
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 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>
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