Skip to main content

UnlessNotFound

Trait UnlessNotFound 

Source
pub trait UnlessNotFound<T> {
    // Required method
    fn unless_not_found(self) -> Result<Option<T>, CallError>;
}
Expand description

Makes a NotFound failure of a call None, for a call for something that may not be there:

ⓘ
use encore::services::UnlessNotFound;

let product = catalog::openapi::get_product("xyz").await.unless_not_found()?;

Required Methods§

Source

fn unless_not_found(self) -> Result<Option<T>, CallError>

Some of what the call answered, None when it failed with a CallError whose code is NotFound, and any other failure as it is.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T> UnlessNotFound<T> for Result<T, CallError>

Implementors§