#[init_empty]
Expand description
This macro takes an fn
as the basis of an InitialState
implementation
for the state type that is returned by the fn
(on success).
The fn
is expected to build the state type specified as a Path
attribute
argument without additional input.
Example:
ⓘ
pub struct B0 {}
#[hax_lib_protocol_macros::init_empty(B0)]
fn init_b() -> ::hax_lib_protocol::ProtocolResult<B0> {
Ok(B0 {})
}
// The following is generated by the macro:
#[hax_lib::exclude]
impl InitialState for B0 {
fn init(prologue: Option<Vec<u8>>) -> ::hax_lib_protocol::ProtocolResult<Self> {
if let Some(_) = prologue {
Err(::hax_lib_protocol::ProtocolError::InvalidPrologue)
} else {
init_b()
}
}
}