(ports: &PortSequence, extend_ty: &str)
| 91 | } |
| 92 | |
| 93 | fn expand(ports: &PortSequence, extend_ty: &str) -> Vec<TokenStream> { |
| 94 | let extend_ty = lit::ident(extend_ty); |
| 95 | ports |
| 96 | .fields |
| 97 | .iter() |
| 98 | .map(|port| { |
| 99 | let Port { name, ty } = port; |
| 100 | match ty { |
| 101 | PortType::Unit => { |
| 102 | quote_spanned!(name.span()=> #name: flow_rs::channel::#extend_ty) |
| 103 | } |
| 104 | PortType::List => { |
| 105 | quote_spanned!(name.span()=> #name: Vec<flow_rs::channel::#extend_ty>) |
| 106 | } |
| 107 | PortType::Dict => { |
| 108 | quote_spanned!(name.span()=> #name: std::collections::HashMap<u64, flow_rs::channel::#extend_ty>) |
| 109 | } |
| 110 | PortType::Dyn => { |
| 111 | quote_spanned!(name.span()=> #name: flow_rs::node::DynPorts<flow_rs::channel::#extend_ty>) |
| 112 | } |
| 113 | } |
| 114 | }) |
| 115 | .collect() |
| 116 | } |
| 117 | |
| 118 | pub fn name_expand(ports: &PortSequence) -> Vec<LitStr> { |
| 119 | ports |
no test coverage detected