stateful

Attribute Macro stateful 

Source
#[stateful]
Expand description

An attribute macro that transforms a function to be stateful.

Adds a state parameter to the function and wraps the function body in the with_state! macro.

§Example

#[stateful(State<S>)]
fn dense(x: i32) -> i32 {
    let y = ::mat_mul(::param(), x);
    y
}

Expands to:

fn dense(state: State<S>, x: i32) -> i32 {
    with_state! { state;
        let y = ::mat_mul(::param(), x);
        y
    }
}