mirror of
https://github.com/Drop-OSS/drop-app-kt.git
synced 2026-02-04 06:51:18 +01:00
chore(errors): Implementing Try and FromResidual for UserValue
Signed-off-by: quexeky <git@quexeky.dev>
This commit is contained in:
committed by
quexeky
parent
5af5bc7be4
commit
a03e935b59
@@ -1,4 +1,4 @@
|
||||
use std::fmt::Display;
|
||||
use std::{fmt::Display, ops::{FromResidual, Try}};
|
||||
|
||||
use serde::Serialize;
|
||||
|
||||
@@ -30,3 +30,23 @@ impl<T: Serialize, D: Display> From<Result<T, D>> for UserValue<T, D> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Serialize, D: Display> Try for UserValue<T, D> {
|
||||
type Output = T;
|
||||
|
||||
type Residual = D;
|
||||
|
||||
fn from_output(output: Self::Output) -> Self {
|
||||
Self::Ok(output)
|
||||
}
|
||||
|
||||
fn branch(self) -> std::ops::ControlFlow<Self::Residual, Self::Output> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Serialize, D: Display> FromResidual for UserValue<T, D> {
|
||||
fn from_residual(residual: <Self as std::ops::Try>::Residual) -> Self {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
#![feature(try_trait_v2)]
|
||||
|
||||
mod database;
|
||||
mod games;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user