mirror of
https://gitlab.com/veilid/veilid.git
synced 2025-08-13 17:05:54 -04:00
bugfixes
This commit is contained in:
parent
a6666d3a6c
commit
00aad2c728
12 changed files with 158 additions and 183 deletions
|
@ -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()])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue