[][src]Trait stdbench::config::CollectionType

pub trait CollectionType: Debug + Downcast + Display {
    fn parse_command(
        &self,
        executor: &dyn PisaExecutor,
        collection: &Collection
    ) -> Result<ExtCommand, Error>; }

Collection type defining parsing command.

Building an index is identical for any collection, but how the files are accessed for parsing differs. This trait is defined in order to enable enhancing this libary with new collection types in the future.

Required methods

fn parse_command(
    &self,
    executor: &dyn PisaExecutor,
    collection: &Collection
) -> Result<ExtCommand, Error>

Returns a command object: its execution will parse the collection and build a forward index.

Loading content...

Methods

impl dyn CollectionType

pub fn is<__T: CollectionType>(&self) -> bool

Returns true if the trait object wraps an object of type __T.

pub fn downcast<__T: CollectionType>(
    self: Box<Self>
) -> Result<Box<__T>, Box<Self>>

Returns a boxed object from a boxed trait object if the underlying object is of type __T. Returns the original boxed trait if it isn't.

pub fn downcast_ref<__T: CollectionType>(&self) -> Option<&__T>

Returns a reference to the object within the trait object if it is of type __T, or None if it isn't.

pub fn downcast_mut<__T: CollectionType>(&mut self) -> Option<&mut __T>

Returns a mutable reference to the object within the trait object if it is of type __T, or None if it isn't.

impl dyn CollectionType[src]

pub fn from<S>(name: S) -> Result<Box<dyn CollectionType>, Error> where
    S: AsRef<str>, 
[src]

Parses a string and returns a requested collection type object, or an error if the name is invalid.

Examples

extern crate downcast_rs;
use downcast_rs::Downcast;
assert!(CollectionType::from("wapo").is_ok());
assert!(CollectionType::from("trecweb").is_ok());
assert!(CollectionType::from("unknown").is_err());

Implementors

impl CollectionType for TrecWebCollection[src]

impl CollectionType for WarcCollection[src]

impl CollectionType for WashingtonPostCollection[src]

Loading content...