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

Method finish_ok

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

Finishes the sink and returns a [`Result`] with a provided success value. Similar to [`finish`], but allows specifying a concrete value for the success case. # 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 = sink.finish

(mut self, ok: T)

Source from the content-addressed store, hash-verified

347 ///
348 /// [`finish`]: ReportSink::finish
349 pub fn finish_ok<T>(mut self, ok: T) -> Result<T, Report<[C]>> {
350 self.bomb.defuse();
351 self.report.map_or(Ok(ok), Err)
352 }
353}
354
355impl<C> Default for ReportSink<C> {

Callers 4

finish_with_valueFunction · 0.80
finish_with_value_okFunction · 0.80

Calls 2

OkInterface · 0.85
defuseMethod · 0.80

Tested by 2

finish_with_valueFunction · 0.64
finish_with_value_okFunction · 0.64