You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: callbacks.rs
    path of file: ./repos/lagon/crates/runtime_isolate/src
    
    the code of the file until where you have to start completion: use lagon_runtime_v8_utils::v8_string;

use crate::get_exception_message;

use super::Isolate;

pub extern "C" fn heap_limit_callback<F>(
    data: *mut std::ffi::c_void,
    current_heap_limit: usize,
    _initial_heap_limit: usize,
) -> usize
where
    F: FnMut(usize) -> usize,
{
    let callback = unsafe { &mut *(data as *mut F) };
    callback(current_heap_limit)
}

pub extern "C" fn promise_reject_callback(message: v8::PromiseRejectMessage) {
    let scope = &mut unsafe { v8::CallbackScope::new(&message) };
    let promise = message.get_promise();
    let promise = v8::Global::new(scope, promise);

    let isolate = Isolate::state(scope);
    let mut state = isolate.borrow_mut();

    match
    
pub extern "C" fn promise_reject_callback(message: v8::PromiseRejectMessage) {
    let scope = &mut unsafe { v8::CallbackScope::new(&message) };
    let promise = message.get_promise();
    let promise = v8::Global::new(scope, promise);

    let isolate = Isolate::state(scope);
    let mut state = isolate.borrow_mut();

    match message.get_event() {
        v8::PromiseRejectEvent::PromiseRejectWithNoHandler => {
            let try_catch = &mut v8::TryCatch::new(scope);

            let exception_message = match message.get_value() {
                Some(exception) => get_exception_message(try_catch, exception, state.lines),
                None => "Unknown error".to_string(),
            };

            state.rejected_promises.insert(promise, exception_message);
        }
        v8::PromiseRejectEvent::PromiseHandlerAddedAfterReject => {
            state.rejected_promises.remove(&promise);
        }
        _ => {}
    }
}