mirror of
https://gitlab.com/veilid/veilid.git
synced 2025-08-14 01:16:10 -04:00
removing dev branch, many changes
This commit is contained in:
parent
1430f3f656
commit
0a890c8707
250 changed files with 18084 additions and 8040 deletions
|
@ -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()])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue