obhq / obliteration

Experimental PS4 emulator written in Rust for Windows, macOS and Linux
https://obliteration.net
MIT License
601 stars 17 forks source link

Explicit add lifetime parameter to IoCmd #739

Closed ultimaweapon closed 1 month ago

ultimaweapon commented 4 months ago

Because hiding it in the macro make the code hard to understand.

SuchAFuriousDeath commented 3 months ago

IoCmd should probably be remade using a proc macro. Declarative macros are too restrictive for this use case.. We could make a trait like

trait Command: Sized {
      type Repr;

      fn try_from_raw_parts(which: Self::Repr, ptr: *mut ()) -> Result<Self, SysErr>;
}

and derive it. It could also be reused for other command-like arguments like in sys_regmgr. Sys_netcontrol also has something similar I think. Sys_ipmimgr as well.