Files
aji/examples/channel_transfer.aji
dev 17a55a7fef Initial import: Aji 0.1 draft spec and Zig scaffolding
Draft specification, RFCs, reference registries and examples, plus the
reference-implementation skeleton: build.zig, diagnostic envelope with
error-code registry synced to docs, aji CLI, conformance runner with seed
tests, CI and contributor docs.
2026-10-04 11:59:13 +03:00

24 lines
428 B
Rust

module examples.channel_transfer;
struct Message {
id: u64,
}
fn producer(
tx: ref<Sender<Island<Message>>>,
alloc: cap<mem.alloc>
) -> Result<void, ChannelError>
effects [mem.alloc]
{
var message = island.create(alloc, Message { id: 0 })?;
borrow message as mut root {
root.id = 42;
}
channel.send(tx, move message)?;
// message is MOVED and cannot be used here.
return Ok();
}