pub fn reply_commit_from_reservation(
id: ReservationId,
value: u128,
) -> Result<MessageId, Error>Expand description
Same as reply_commit, but it spends gas from a reservation instead of
borrowing it from the gas limit provided with the incoming message.
§Examples
use gstd::{ReservationId, msg, prelude::*};
#[unsafe(no_mangle)]
extern "C" fn handle() {
msg::reply_push(b"Hello,").expect("Unable to push");
msg::reply_push(b" world!").expect("Unable to push");
let reservation_id = ReservationId::reserve(5_000_000, 100).expect("Unable to reserves");
msg::reply_commit_from_reservation(reservation_id, 42).expect("Unable to commit");
}§See also
reply_pushfunction allows forming a reply message in parts.ReservationIdstruct allows reserve gas for later use.