This commit is contained in:
Christien Rioux 2023-07-25 01:04:22 -04:00
parent a6666d3a6c
commit 00aad2c728
12 changed files with 158 additions and 183 deletions

View file

@ -52,17 +52,6 @@ impl DartIsolateWrapper {
});
}
pub fn spawn_result_opt_json<F, T, E>(self, future: F)
where
F: Future<Output = Result<Option<T>, E>> + Send + 'static,
T: Serialize + Debug,
E: Serialize + Debug,
{
spawn(async move {
self.result_opt_json(future.await);
});
}
pub fn result<T: IntoDart + Debug, E: Serialize + Debug>(self, result: Result<T, E>) -> bool {
match result {
Ok(v) => self.ok(v),
@ -78,16 +67,6 @@ impl DartIsolateWrapper {
Err(e) => self.err_json(e),
}
}
pub fn result_opt_json<T: Serialize + Debug, E: Serialize + Debug>(
self,
result: Result<Option<T>, E>,
) -> bool {
match result {
Ok(Some(v)) => self.ok_json(v),
Ok(None) => self.ok(()),
Err(e) => self.err_json(e),
}
}
pub fn ok<T: IntoDart>(self, value: T) -> bool {
self.isolate
.post(vec![MESSAGE_OK.into_dart(), value.into_dart()])