And a function:
fn bt_send_hci_command(cmd: &HCICommand) -> HCIResponse
{
let mut ret = HCIResponse{eventcode: 0, length: 0, params: &[0 as u8]};
ret
}
Which gets me an error on "-> HCIResponse" in the function
missing lifetime specifier [E0106]:
this function's return type contains a borrowed value, but the signature does not say which one of cmd's 2 elided lifetimes it is borrowed from
expected lifetime parameter
which says there is a problem with the lifetimes in HCICommand?
But your code still won't build because of this line:
params: &[0 as u8],
The struct doesn't own the array, only a reference to it. So once you return from the function, the array is freed from the stack and you end up pointing to garbage.