[−][src]Struct fuse_rust::FuseProperty
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
impl FuseProperty
[src]
pub fn init(value: &str) -> Self
[src]
create a fuse property with weight 1.0 and a string reference.
pub fn init_with_weight(value: &str, weight: f64) -> Self
[src]
create a fuse property with a specified weight and string reference.
Auto Trait Implementations
impl RefUnwindSafe for FuseProperty
[src]
impl Send for FuseProperty
[src]
impl Sync for FuseProperty
[src]
impl Unpin for FuseProperty
[src]
impl UnwindSafe for FuseProperty
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,