mirror of
https://github.com/fluencelabs/sqlite-wasm-connector
synced 2025-07-30 21:52:16 +00:00
Implement Readable for Option<T>
This commit is contained in:
@@ -297,6 +297,17 @@ impl Readable for Vec<u8> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Readable> Readable for Option<T> {
|
||||
#[inline]
|
||||
fn read(statement: &Statement, i: usize) -> Result<Self> {
|
||||
if statement.kind(i) == Type::Null {
|
||||
Ok(None)
|
||||
} else {
|
||||
T::read(statement, i).map(Some)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn new<'l, T: AsRef<str>>(raw1: *mut ffi::sqlite3, statement: T) -> Result<Statement<'l>> {
|
||||
let mut raw0 = 0 as *mut _;
|
||||
|
Reference in New Issue
Block a user