removing dev branch, many changes

This commit is contained in:
John Smith 2023-05-29 19:24:57 +00:00
parent 1430f3f656
commit 0a890c8707
250 changed files with 18084 additions and 8040 deletions

View file

@ -52,6 +52,17 @@ 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),
@ -67,6 +78,16 @@ 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()])