예제 #1
0
extern "C" CDECL void
upcall_s_vec_grow(s_vec_grow_args *args) {
    rust_task *task = rust_scheduler::get_task();
    LOG_UPCALL_ENTRY(task);
    reserve_vec(task, args->vp, args->new_sz);
    (*args->vp)->fill = args->new_sz;
}
예제 #2
0
extern "C" CDECL void
rust_str_push(rust_vec_box** sp, uint8_t byte) {
    rust_task *task = rust_get_current_task();
    size_t fill = (*sp)->body.fill;
    reserve_vec(task, sp, fill + 1);
    (*sp)->body.data[fill-1] = byte;
    (*sp)->body.data[fill] = 0;
    (*sp)->body.fill = fill + 1;
}
예제 #3
0
extern "C" CDECL void
rust_str_push(rust_vec** sp, uint8_t byte) {
    rust_task *task = rust_scheduler::get_task();
    size_t fill = (*sp)->fill;
    reserve_vec(task, sp, fill + 1);
    (*sp)->data[fill-1] = byte;
    (*sp)->data[fill] = 0;
    (*sp)->fill = fill + 1;
}
예제 #4
0
extern "C" CDECL void
upcall_s_vec_push(s_vec_push_args *args) {
    rust_task *task = rust_scheduler::get_task();
    LOG_UPCALL_ENTRY(task);
    size_t new_sz = (*args->vp)->fill + args->elt_ty->size;
    reserve_vec(task, args->vp, new_sz);
    rust_vec* v = *args->vp;
    copy_elements(task, args->elt_ty, &v->data[0] + v->fill, 
                  args->elt, args->elt_ty->size);
    v->fill += args->elt_ty->size;
}
예제 #5
0
extern "C" CDECL void
vec_reserve_shared(type_desc* ty, rust_vec** vp,
                   size_t n_elts) {
    rust_task *task = rust_scheduler::get_task();
    reserve_vec(task, vp, n_elts * ty->size);
}