Function gcore::exec::exit

source ·
pub fn exit(inheritor_id: ActorId) -> !
Expand description

Terminate the execution of a program.

The program and all corresponding data are removed from the storage. It may be called in the init method as well. One can consider this function as some analog of std::process::exit.

inheritor_id specifies the address to which all available program value should be transferred.

§Examples

Terminate the program and transfer the available value to the message sender:

use gcore::{exec, msg};

#[no_mangle]
extern "C" fn handle() {
    // ...
    exec::exit(msg::source());
}