Trait duckdb::OptionalExt

source ·
pub trait OptionalExt<T> {
    // Required method
    fn optional(self) -> Result<Option<T>>;
}
Expand description

Required Methods§

source

fn optional(self) -> Result<Option<T>>

Converts a Result<T> into a Result<Option<T>>.

By default, duckdb-rs treats 0 rows being returned from a query that is expected to return 1 row as an error. This method will handle that error, and give you back an Option<T> instead.

Implementors§

source§

impl<T> OptionalExt<T> for Result<T>