summaryrefslogtreecommitdiff
path: root/subplotlib
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2020-12-29 13:17:07 +0000
committerDaniel Silverstone <dsilvers@digital-scurf.org>2020-12-29 13:17:07 +0000
commit2748070051a28a522be79da4940749461d153bf1 (patch)
treecf54d8f9d7716790c0c02665845c48020e0d36c6 /subplotlib
parent780d4c3e04e3884abb8250f0f86ebd28013ac592 (diff)
downloadsubplot-2748070051a28a522be79da4940749461d153bf1.tar.gz
subplotlib: Permit non-unit returns from context.with{,_mut}
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
Diffstat (limited to 'subplotlib')
-rw-r--r--subplotlib/src/scenario.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/subplotlib/src/scenario.rs b/subplotlib/src/scenario.rs
index 9b95737..cd83ac1 100644
--- a/subplotlib/src/scenario.rs
+++ b/subplotlib/src/scenario.rs
@@ -187,18 +187,18 @@ impl ScenarioContext {
}
/// With the extracted immutable context, run the function f.
- pub fn with<C, F>(&self, func: F, defuse_poison: bool) -> StepResult
+ pub fn with<C, F, R>(&self, func: F, defuse_poison: bool) -> Result<R, StepError>
where
- F: FnOnce(&C) -> StepResult,
+ F: FnOnce(&C) -> Result<R, StepError>,
C: ContextElement,
{
self.with_mut(|c: &mut C| func(&*c), defuse_poison)
}
/// With the extracted mutable context, run the function f.
- pub fn with_mut<C, F>(&self, func: F, defuse_poison: bool) -> StepResult
+ pub fn with_mut<C, F, R>(&self, func: F, defuse_poison: bool) -> Result<R, StepError>
where
- F: FnOnce(&mut C) -> StepResult,
+ F: FnOnce(&mut C) -> Result<R, StepError>,
C: ContextElement,
{
let sci: &ScenarioContextItem<C> = self