MCPcopy Create free account
hub / github.com/MegEngine/MegFlow / parse

Method parse

flow-derive/src/ports.rs:37–70  ·  view source on GitHub ↗
(input: ParseStream)

Source from the content-addressed store, hash-verified

35
36impl Parse for Port {
37 fn parse(input: ParseStream) -> Result<Self> {
38 let name: syn::Ident = input.parse()?;
39 Ok(if input.peek(Token![:]) {
40 input.parse::<Token![:]>()?;
41 if input.peek(syn::token::Dyn) {
42 input.parse::<syn::token::Dyn>()?;
43 Port {
44 name,
45 ty: PortType::Dyn,
46 }
47 } else if input.peek(syn::token::Bracket) {
48 let _content;
49 bracketed!(_content in input);
50 Port {
51 name,
52 ty: PortType::List,
53 }
54 } else if input.peek(syn::token::Brace) {
55 let _content;
56 braced!(_content in input);
57 Port {
58 name,
59 ty: PortType::Dict,
60 }
61 } else {
62 return Err(input.error("expect []"));
63 }
64 } else {
65 Port {
66 name,
67 ty: PortType::Unit,
68 }
69 })
70 }
71}
72
73pub struct PortSequence {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected