Skip to main content

Result

Type Alias Result 

Source
pub type Result<T> = Result<T, Error>;
Expand description

A specialised Result for bison-db operations.

Used throughout the public API so callers can rely on a single error type.

§Examples

use bison_db::{Document, Result, Value};

fn name_of(doc: &Document) -> Result<&str> {
    // `Value::as_str` borrows; the surrounding code propagates with `?`.
    Ok(doc.get("name").and_then(Value::as_str).unwrap_or("<unknown>"))
}

Aliased Type§

pub enum Result<T> {
    Ok(T),
    Err(Error),
}

Variants§

§1.0.0

Ok(T)

Contains the success value

§1.0.0

Err(Error)

Contains the error value