Skip to main content

StoreResultUnitExt

Trait StoreResultUnitExt 

Source
pub trait StoreResultUnitExt<E: StoreErrorPredicates> {
    // Required method
    fn idempotent(self) -> Result<(), E>;
}
Expand description

Extension methods for unit (()) store results, typically produced by write operations.

Required Methods§

Source

fn idempotent(self) -> Result<(), E>

Treats a duplicate-write error as success, making the operation idempotent.

Mapping:

  • Ok(()) -> Ok(())
  • Err(e) where e.is_already_exists() -> Ok(())
  • any other Err(e) -> Err(e)

This method does not panic.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<E: StoreErrorPredicates> StoreResultUnitExt<E> for Result<(), E>

Source§

fn idempotent(self) -> Result<(), E>

Implementors§