Skip to main content

send_granting

Function send_granting 

Source
pub fn send_granting(
    ctx: &ServiceContext,
    to: Cap,
    granting: Cap,
    msg: &Message,
) -> Result<(), Error>
Expand description

Send a message that CARRIES a capability, giving it away.

The capability MOVES (CLAUDE.md 8.5). Three things are true every time and none of them are checked for you at compile time:

  1. The capability must hold GRANT, or this is refused.
  2. On success it is no longer yours. Using it afterwards is using something you do not hold.
  3. On failure it stayed - reclaim the slot with cap::remove rather than leaking it.

So the result is never ignorable: it decides what you may do next.