MCPcopy Create free account
hub / github.com/RustCrypto/utils / map_or_default

Method map_or_default

ctutils/src/ct_option.rs:343–349  ·  view source on GitHub ↗
(self, f: F)

Source from the content-addressed store, hash-verified

341 #[inline]
342 #[must_use]
343 pub fn map_or_default<U, F>(self, f: F) -> U
344 where
345 U: CtSelect + Default,
346 F: FnOnce(T) -> U,
347 {
348 self.map_or(U::default(), f)
349 }
350
351 /// Transforms a `CtOption<T>` into a `Result<T, E>`, mapping to `Ok(T)` if `self.is_some()` is
352 /// [`Choice::TRUE`], or mapping to the provided `err` in the event `self.is_some()` is

Callers

nothing calls this directly

Calls 2

defaultFunction · 0.85
map_orMethod · 0.80

Tested by

no test coverage detected