pub struct ChannelDecl {
pub kind: ChannelKind,
pub name: String,
pub sender: String,
pub receiver: String,
pub buffer: Option<ChannelBuffer>,
pub payload: Option<Type>,
pub sender_offset: usize,
pub receiver_offset: usize,
pub span: Range<usize>,
}Expand description
Channel declaration connecting two protection domains.
§Chan Declaration (.fis)
Declares a communication channel between two protection domains. A
signalling channel carries no value (c!, c?); a message-passing
channel carries values of a type (c!e, c?x): a buffered channel, or a
Sync Chan<T>, whose call passes the value in the message registers.
| Form | Syntax | Direction | Kind |
|---|---|---|---|
| Async bidirectional | [Async] Chan name = sender <-> receiver; | both ways | signalling |
| Async unidirectional | [Async] Chan name = sender --> receiver; | sender → receiver only | signalling |
| Sync unidirectional | Sync Chan name = sender --> receiver; | sender → receiver only | a protected procedure call, signalling |
| Sync with a value | Sync Chan<T> name = sender --> receiver; | sender → receiver only | a protected procedure call carrying a T |
| Buffered | [Async] Chan name = sender --> receiver via region<T>; | sender → receiver only | message passing, a FIFO of T |
The Async keyword is optional for async channels; Chan without Sync is always async.
Only an async --> channel has a buffer (via region<T>); <-> and Sync carry none,
and only Sync takes <T>.
The trailing ; is optional.
Chan link = client <-> server; // signalling, both ways
Chan tx = producer --> consumer; // signalling, one way
Async Chan out = sender --> recv; // explicit async keyword
Sync Chan rpc = caller --> handler; // signalling, synchronous
Chan pkt = producer --> consumer via buf<Packet>; // bufferedLanguage reference: Channel Declarations.
Fields§
§kind: ChannelKindChannel kind (sync/async, uni/bidirectional).
name: StringChannel name.
sender: StringSender (left) endpoint.
For SyncUni/AsyncUni, this PD initiates the communication.
For AsyncBi, this is the left-hand PD in the declaration.
receiver: StringReceiver (right) endpoint.
For SyncUni/AsyncUni, this PD receives the communication.
For AsyncBi, this is the right-hand PD in the declaration.
buffer: Option<ChannelBuffer>Optional backing memory buffer (via buf / via buf<Type>).
None — signal only, no shared memory.
payload: Option<Type>The value a Sync Chan<T> carries, in the message registers; None
for every other channel, whose value (if any) is its buffer’s.
sender_offset: usizeByte offset of sender identifier in the source.
receiver_offset: usizeByte offset of receiver identifier in the source.
span: Range<usize>Byte span of the entire declaration in the source.
Trait Implementations§
Source§impl Clone for ChannelDecl
impl Clone for ChannelDecl
Source§fn clone(&self) -> ChannelDecl
fn clone(&self) -> ChannelDecl
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more