fix crash
This commit is contained in:
parent
07e3e45579
commit
76ffd7af5b
|
@ -29,16 +29,28 @@ macro_rules! impl_tuple {
|
|||
&self,
|
||||
qstate: &mut crate::unbound::ModuleQstateMut<Self::QstateData>,
|
||||
event: crate::unbound::ModuleEvent,
|
||||
entry: &mut crate::unbound::OutboundEntryMut,
|
||||
entry: Option<&mut crate::unbound::OutboundEntryMut>,
|
||||
) -> Option<ModuleExtState> {
|
||||
// lol idk how to safely "clone" Option<&mut>
|
||||
if let Some(entry) = entry {
|
||||
#[allow(unused_mut)]
|
||||
let mut ret = self.0.operate(qstate, event, entry);
|
||||
$(if let Some(state) = self.$i.operate(qstate, event, entry) {
|
||||
let mut ret = self.0.operate(qstate, event, Some(entry));
|
||||
$(if let Some(state) = self.$i.operate(qstate, event, Some(entry)) {
|
||||
if !matches!(ret, Some(ret) if ret.importance() >= state.importance()) {
|
||||
ret = Some(state);
|
||||
}
|
||||
})*
|
||||
ret
|
||||
} else {
|
||||
#[allow(unused_mut)]
|
||||
let mut ret = self.0.operate(qstate, event, None);
|
||||
$(if let Some(state) = self.$i.operate(qstate, event, None) {
|
||||
if !matches!(ret, Some(ret) if ret.importance() >= state.importance()) {
|
||||
ret = Some(state);
|
||||
}
|
||||
})*
|
||||
ret
|
||||
}
|
||||
}
|
||||
fn get_mem(&self, env: &mut crate::unbound::ModuleEnvMut<Self::EnvData>) -> usize {
|
||||
self.0.get_mem(env) $(* self.$i.get_mem(env))*
|
||||
|
|
|
@ -716,7 +716,7 @@ impl UnboundMod for ExampleMod {
|
|||
&self,
|
||||
qstate: &mut crate::unbound::ModuleQstateMut<Self::QstateData>,
|
||||
event: ModuleEvent,
|
||||
_entry: &mut crate::unbound::OutboundEntryMut,
|
||||
_entry: Option<&mut crate::unbound::OutboundEntryMut>,
|
||||
) -> Option<ModuleExtState> {
|
||||
match event {
|
||||
ModuleEvent::New | ModuleEvent::Pass => {
|
||||
|
|
|
@ -32,7 +32,7 @@ pub trait UnboundMod: Send + Sync + Sized + RefUnwindSafe + UnwindSafe {
|
|||
&self,
|
||||
_qstate: &mut unbound::ModuleQstateMut<Self::QstateData>,
|
||||
_event: unbound::ModuleEvent,
|
||||
_entry: &mut unbound::OutboundEntryMut,
|
||||
_entry: Option<&mut unbound::OutboundEntryMut>,
|
||||
) -> Option<ModuleExtState> {
|
||||
Some(ModuleExtState::Finished)
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ unsafe impl<T: UnboundMod> SealedUnboundMod for T {
|
|||
if let Some(ext_state) = self.operate(
|
||||
&mut unbound::ModuleQstateMut::from_raw(qstate, id).unwrap(),
|
||||
event.into(),
|
||||
&mut unbound::OutboundEntryMut::from_raw(entry).unwrap(),
|
||||
unbound::OutboundEntryMut::from_raw(entry).as_mut(),
|
||||
) {
|
||||
if let Some(id) = unbound::check_id(id) {
|
||||
(*qstate).ext_state[id] = ext_state as bindings::module_ext_state;
|
||||
|
|
Loading…
Reference in a new issue