mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2025-12-06 03:36:42 +01:00
This commit is contained in:
parent
91dc77cfea
commit
11f686650f
19 changed files with 964 additions and 918 deletions
|
|
@ -46,9 +46,9 @@ pub trait MaybeHas<T>: Send + Sync {
|
|||
/// May compute a `RetVal` from `Args`.
|
||||
pub trait Eval<Args, RetVal> {
|
||||
/// A custom operation on [Args] that may return [Result::Err] or [Option::None].
|
||||
fn try_eval (&self, args: Args) -> Perhaps<RetVal>;
|
||||
fn try_eval (&self, args: &Args) -> Perhaps<RetVal>;
|
||||
/// Invoke a custom operation, converting a `None` result to a custom `Box<dyn Error>`.
|
||||
fn eval <E: Into<Box<dyn std::error::Error>>> (&self, args: Args, error: impl Fn()->E)
|
||||
fn eval <E: Into<Box<dyn std::error::Error>>> (&self, args: &Args, error: impl Fn()->E)
|
||||
-> Usually<RetVal>
|
||||
{
|
||||
match self.try_eval(args)? {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue