[][src]Struct estimated_read_time::Options

pub struct Options { /* fields omitted */ }

Some Options to be set which decides the calculation of avg. time taken to read a text.

Methods

impl Options[src]

pub fn new() -> Options[src]

Creates a new instance of Options with default values set. For Default Values, refer the documentation of each method below.

pub fn word_length(self, word_length: u32) -> Self[src]

Avg. length of one word which will be used to count the total no. of word in the content passed.

Arguments

  • word_length - The word length to be considered to count the total no. of words. [Default Value - 4]

pub fn get_word_length(&self) -> u32[src]

Returns the avg. word length used to compute the total no. of words in a text.

pub fn wpm(self, wpm: u32) -> Self[src]

The Avg. WPM (Words per minute) a person can read or taken to read a text

Arguments

  • wpm - The Avg. WPM to be considered for the text. [Default Value - 265]

pub fn get_wpm(&self) -> u32[src]

Returns the avg. WPM

pub fn technical_document(self, is_technical_document: bool) -> Self[src]

Sets whether the text is a technical document or not. Setting this to true assumes that reading a technical document takes more time than a simple document.

Arguments

  • is_technical_document - true/false. [Default Value - false]

pub fn is_technical_document(&self) -> bool[src]

Returns whether it is technical document.

pub fn technical_difficulty(self, technical_difficulty: u8) -> Self[src]

Sets the technical difficulty of the document. More the difficuly, more time to read.

Arguments

  • technical_difficulty - Technical Difficulty value in the range [1, 5]. [Default Value - 3]

pub fn get_technical_difficulty(&self) -> u8[src]

Returns the Technical Difficulty value.

pub fn previous_read_time(self, total_words: u64, total_seconds: u64) -> Self[src]

Total Words read in Total Seconds previously. If this is set, it will be used to calculate WPM. This Calculated WPM takes higher precedence than the default WPM and WPM set using wpm().

This can be useful when maintaining state for individual users.

Arguments

  • total_words - Total Words read. [Default Value - 0]
  • total_seconds - Total seconds taken to read the total_words. [Default Value - 0]

pub fn build(self) -> Result<Options, String>[src]

Trait Implementations

impl Default for Options[src]

Returns the Options object with the default values set.

Auto Trait Implementations

impl Send for Options

impl Sync for Options

impl Unpin for Options

impl UnwindSafe for Options

impl RefUnwindSafe for Options

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = !

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]