MCPcopy Create free account
hub / github.com/hashintel/hash / finish_default

Method finish_default

libs/error-stack/src/sink.rs:326–329  ·  view source on GitHub ↗

Finishes the sink and returns a [`Result`] with a default success value. Similar to [`finish`], but uses `T::default()` as the success value. # Examples ``` # use error_stack::ReportSink; # use std::io; let mut sink = ReportSink::new(); # // needed for type inference # sink.capture(io::Error::new(io::ErrorKind::Other, "I/O error")); // ... add errors ... let result: Result , _> = sin

(mut self)

Source from the content-addressed store, hash-verified

324 ///
325 /// [`finish`]: ReportSink::finish
326 pub fn finish_default<T: Default>(mut self) -> Result<T, Report<[C]>> {
327 self.bomb.defuse();
328 self.report.map_or_else(|| Ok(T::default()), Err)
329 }
330
331 /// Finishes the sink and returns a [`Result`] with a provided success value.
332 ///

Callers

nothing calls this directly

Calls 3

OkInterface · 0.85
defuseMethod · 0.80
defaultFunction · 0.50

Tested by

no test coverage detected