[][src]Function cql_db::read_value_unchecked

pub fn read_value_unchecked<TStore: CqlReadable>(
    db_location: &str,
    location: &[u64]
) -> Result<TStore::ValueType, Error>

Reads the value at the given location from the database. Does not validate given parameters.

Can result in reading from an 'alternative' location if provided with an invalid location in the final dimension, other invalid dimensions will likely result in a panic.

Errors

Will return any I/O errors encountered during the execution of the function.

Panics

Function does not actively defend against panics, and may do so if given invalid parameters.

Examples

let point = [2, 4, 3, 1];
let value = 5;

cql_db::create_db::<U64>(
    DATABASE_LOCATION,
    &[2, 5, 3, 2]
)?;

// higher order elements must be linked before they can be read from
cql_db::link_dimensions::<U64>(
    DATABASE_LOCATION,
    &point[0..3],
)?;

// Read the default value from point `point`
let result1 = cql_db::read_value_unchecked::<U64>(
    DATABASE_LOCATION,
    &point
)?;

assert_eq!(0, result1);

// Write `value` to location `[2, 4, 3, 1]`
cql_db::write_value::<U64>(
    DATABASE_LOCATION,
    &point,
    value
)?;

// Read the now-populated value from point `point`
let result2 = cql_db::read_value_unchecked::<U64>(
    DATABASE_LOCATION,
    &point
)?;

assert_eq!(value, result2);