Skip to main content

sim_lib_stream_prelude/
cap.rs

1use sim_kernel::CapabilityName;
2
3/// Returns the `stream.open` capability name gating source/sink construction.
4///
5/// The prelude's `stream/open` function requires this capability before it
6/// builds a memory stream handle.
7pub fn stream_open_capability() -> CapabilityName {
8    CapabilityName::new("stream.open")
9}
10
11/// Returns the `stream.read` capability name gating packet reads.
12///
13/// Functions that pull packets (for example `stream/next!`, `stream/run!`, and
14/// the combinator stages) require this capability.
15pub fn stream_read_capability() -> CapabilityName {
16    CapabilityName::new("stream.read")
17}
18
19/// Returns the `stream.write` capability name gating sink writes.
20///
21/// Functions that push packets into a sink (for example `stream/write!` and a
22/// pipeline that runs into a sink) require this capability.
23pub fn stream_write_capability() -> CapabilityName {
24    CapabilityName::new("stream.write")
25}
26
27/// Returns the `stream.control` capability name gating live control cells.
28///
29/// The live control surface (for example `stream/cell-set!`) requires this
30/// capability before mutating a versioned control cell.
31pub fn stream_control_capability() -> CapabilityName {
32    CapabilityName::new("stream.control")
33}
34
35/// Returns the `stream.transform` capability name gating shape-aware stages.
36///
37/// Combinator stages that evaluate caller-supplied shapes or callables (for
38/// example `stream/filter-shape` and `stream/map-expr`) require this
39/// capability in addition to `stream.read`.
40pub fn stream_transform_capability() -> CapabilityName {
41    CapabilityName::new("stream.transform")
42}