[oden-js] Promise completion should be FnOnce

This commit is contained in:
John Doty 2023-06-30 05:52:32 -07:00
parent 3b2af4bb14
commit 44c39b1740

View file

@ -12,7 +12,7 @@ impl PromiseHandle {
} }
} }
pub type PromiseResult = Box<dyn Fn(&ContextRef) -> ValueResult + Send + 'static>; pub type PromiseResult = Box<dyn FnOnce(&ContextRef) -> ValueResult + Send + 'static>;
pub(crate) enum PromiseEvent { pub(crate) enum PromiseEvent {
Resolved(PromiseResult), Resolved(PromiseResult),
@ -48,7 +48,7 @@ impl Promise {
pub fn resolve<T>(mut self, value: T) pub fn resolve<T>(mut self, value: T)
where where
T: Fn(&ContextRef) -> ValueResult + Send + 'static, T: FnOnce(&ContextRef) -> ValueResult + Send + 'static,
{ {
let _ = self let _ = self
.channel .channel
@ -58,7 +58,7 @@ impl Promise {
pub fn reject<T>(mut self, value: T) pub fn reject<T>(mut self, value: T)
where where
T: Fn(&ContextRef) -> ValueResult + Send + 'static, T: FnOnce(&ContextRef) -> ValueResult + Send + 'static,
{ {
let _ = self let _ = self
.channel .channel