Struct rsmorphy::container::dict::Dictionary [] [src]

pub struct Dictionary {
    pub word_lower: Word,
    pub para_id: u16,
    pub idx: u16,
}

Fields

Methods

impl Dictionary
[src]

Trait Implementations

impl Debug for Dictionary
[src]

Formats the value using the given formatter.

impl Clone for Dictionary
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl PartialEq for Dictionary
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Source for Dictionary
[src]

impl MorphySerde for Dictionary
[src]

use rsmorphy::container::Dictionary;
use rsmorphy::container::Word;
use rsmorphy::container::abc::*;

assert_eq!(
    Dictionary::decode(r"d:сталь,d"),
    Ok(("", Dictionary {
        word_lower: Word {
            word: "сталь".into(),
            is_known: true
        },
        para_id: 0xd,
        idx: 0
    }))
);

assert_eq!(
    Dictionary::decode(r"d:стали,d,1"),
    Ok(("", Dictionary {
        word_lower: Word {
            word: "стали".into(),
            is_known: true
        },
        para_id: 0xd,
        idx: 1
    }))
);

assert_eq!(
    Dictionary::decode(r"f:бутявкает,2cb,9"),
    Ok(("", Dictionary {
        word_lower: Word {
            word: "бутявкает".into(),
            is_known: false
        },
        para_id: 0x2cb,
        idx: 9
    }))
);

assert_eq!(
    Dictionary::decode(r"d:стали"),
    Err(DecodeError::UnexpectedEnd)
);