Finishes the sink and returns a [`Result`] with a custom success value. Similar to [`finish`], but allows specifying a function to generate 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 = sink.finis
(mut self, ok: impl FnOnce() -> T)
| 301 | /// |
| 302 | /// [`finish`]: ReportSink::finish |
| 303 | pub fn finish_with<T>(mut self, ok: impl FnOnce() -> T) -> Result<T, Report<[C]>> { |
| 304 | self.bomb.defuse(); |
| 305 | self.report.map_or_else(|| Ok(ok()), Err) |
| 306 | } |
| 307 | |
| 308 | /// Finishes the sink and returns a [`Result`] with a default success value. |
| 309 | /// |