Struct Database

Source
pub struct Database {
    pub name: String,
    pub desc: String,
}

Fields§

§name: String§desc: String

Implementations§

Source§

impl Database

Source

pub fn all() -> Self

Examples found in repository?
examples/read_definitions.rs (line 14)
7fn main() {
8    let addr = std::env::args().next_back().unwrap();
9    let stream = TcpStream::connect(addr).expect("Invalid socket address");
10
11    let mut conn = DICTConnection::new(stream).unwrap();
12    conn.next();
13
14    let (defs, _) = conn.define(Database::all(), String::from("ti")).expect("Damn");
15
16    for def in defs {
17        println!("{}", def.source.desc);
18    }
19}
More examples
Hide additional examples
examples/read_matches.rs (line 14)
7fn main() {
8    let addr = std::env::args().next_back().unwrap();
9    let stream = TcpStream::connect(addr).expect("Invalid socket address");
10
11    let mut conn = DICTConnection::new(stream).unwrap();
12    conn.next();
13
14    let (matches, _) = conn.match_db(Database::all(), Strategy::default(), String::from("ti")).expect("Damn");
15
16    for m in matches {
17        println!("{} : {}", m.source.desc, m.word);
18    }
19}
Source

pub fn first() -> Self

Trait Implementations§

Source§

impl Debug for Database

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Database

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl From<String> for Database

Source§

fn from(src: String) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.