pub enum ParseOutcome<T, E> {
Done,
Ok(T),
Err(E),
}Expand description
Tri-state parse result for statement-oriented parser APIs.
Mirrors C parser return codes:
ParseOutcome::Done->SYNTAQLITE_PARSE_DONEParseOutcome::Ok->SYNTAQLITE_PARSE_OKParseOutcome::Err->SYNTAQLITE_PARSE_ERROR
Variants§
Done
No more statements/results are available.
Ok(T)
A statement parsed successfully.
Err(E)
A statement parsed with an error.
Implementations§
Source§impl<T, E> ParseOutcome<T, E>
impl<T, E> ParseOutcome<T, E>
Sourcepub fn transpose(self) -> Result<Option<T>, E>
pub fn transpose(self) -> Result<Option<T>, E>
Convert into Result<Option<T>, E> for ?-friendly control flow.
§Errors
Returns Err(e) when the outcome is ParseOutcome::Err.
Sourcepub fn map<U>(self, f: impl FnOnce(T) -> U) -> ParseOutcome<U, E>
pub fn map<U>(self, f: impl FnOnce(T) -> U) -> ParseOutcome<U, E>
Map the Ok(T) payload.
Sourcepub fn map_err<F>(self, f: impl FnOnce(E) -> F) -> ParseOutcome<T, F>
pub fn map_err<F>(self, f: impl FnOnce(E) -> F) -> ParseOutcome<T, F>
Map the Err(E) payload.
Trait Implementations§
Source§impl<T: Clone, E: Clone> Clone for ParseOutcome<T, E>
impl<T: Clone, E: Clone> Clone for ParseOutcome<T, E>
Source§fn clone(&self) -> ParseOutcome<T, E>
fn clone(&self) -> ParseOutcome<T, E>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<T: Copy, E: Copy> Copy for ParseOutcome<T, E>
impl<T: Eq, E: Eq> Eq for ParseOutcome<T, E>
impl<T, E> StructuralPartialEq for ParseOutcome<T, E>
Auto Trait Implementations§
impl<T, E> Freeze for ParseOutcome<T, E>
impl<T, E> RefUnwindSafe for ParseOutcome<T, E>where
T: RefUnwindSafe,
E: RefUnwindSafe,
impl<T, E> Send for ParseOutcome<T, E>
impl<T, E> Sync for ParseOutcome<T, E>
impl<T, E> Unpin for ParseOutcome<T, E>
impl<T, E> UnsafeUnpin for ParseOutcome<T, E>where
T: UnsafeUnpin,
E: UnsafeUnpin,
impl<T, E> UnwindSafe for ParseOutcome<T, E>where
T: UnwindSafe,
E: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more