Function gcore::msg::send_commit_from_reservation
source · pub fn send_commit_from_reservation(
reservation_id: ReservationId,
handle: MessageHandle,
destination: ActorId,
value: u128,
) -> Result<MessageId>
Expand description
Same as send_commit
, but it spends gas from a reservation instead of
borrowing it from the gas limit provided with the incoming message.
§Examples
use gcore::{exec, msg};
#[no_mangle]
extern "C" fn handle() {
let reservation_id = exec::reserve_gas(5_000_000, 100).expect("Unable to reserve");
let msg_handle = msg::send_init().expect("Unable to init");
msg::send_push(msg_handle, b"Hello,").expect("Unable to push");
msg::send_push(msg_handle, b" world!").expect("Unable to push");
msg::send_commit_from_reservation(reservation_id, msg_handle, msg::source(), 42)
.expect("Unable to commit");
}
§See also
send_from_reservation
allows sending message by using gas from reservation.send_push
,send_init
functions allows forming message to send in parts.