futuresdr_types/
description.rs

1use serde::Deserialize;
2use serde::Serialize;
3
4use crate::BlockId;
5use crate::PortId;
6
7/// Description of a `Flowgraph`.
8///
9/// This struct can be serialized to be used with the REST API.
10#[derive(Debug, Clone, Serialize, Deserialize)]
11pub struct FlowgraphDescription {
12    /// Blocks
13    pub blocks: Vec<BlockDescription>,
14    /// Stream edges
15    pub stream_edges: Vec<(BlockId, PortId, BlockId, PortId)>,
16    /// Message edges
17    pub message_edges: Vec<(BlockId, PortId, BlockId, PortId)>,
18}
19
20/// Description of a `Block`.
21///
22/// This struct can be serialized to be used with the REST API.
23#[derive(Debug, Clone, Serialize, Deserialize)]
24pub struct BlockDescription {
25    /// Id
26    pub id: BlockId,
27    /// Type name
28    pub type_name: String,
29    /// Instance name
30    pub instance_name: String,
31    /// Stream inputs
32    pub stream_inputs: Vec<String>,
33    /// Stream outputs
34    pub stream_outputs: Vec<String>,
35    /// Message inputs
36    pub message_inputs: Vec<String>,
37    /// Message outputs
38    pub message_outputs: Vec<String>,
39    /// Blocking
40    ///
41    /// Blocking blocks have an async API but are spawned in a separate thread, i.e., it is ok to
42    /// block inside the async function.
43    pub blocking: bool,
44}