Skip to content

Expose ergonomic move between usize and capability types

Ben requested to merge Ben-PH/devbox:objcap_usize_transform into master

There is currently no ergonomic means to get the underlying usize out of a capability, or to make a capability out of a usize. This allows the following replacement:

// old usage
let cap_cpy = unsafe { sel4::CNode::from(
    sel4::Cap::from_usize(
        sel4.CPtr::from_useze(
            cap.as_ref().as_cptr().as_usize()
        )
    )
)};
// new usage
let cap_cpy = unsafe {sel4::CNode::from_usize(cap.as_usize)};

This is not ideal, as it doesn't help the problem of how leverage rust to manage capabilities safely, but in the meantime, it provides the same functionality in a more usable way.

Merge request reports