addStructuredInterface<InterfaceType extends Interface<TagType> , TagType extends Enum> method
- @experimental
Registers source on this Module and returns its internal clone.
Module logic must use the returned clone rather than source. Ports
selected by inputTags and outputTags become grouped typed
LogicStructure ports, except that a single field remains a direct port.
Ports selected by inOutTags remain individual inOut ports.
name prefixes the generated directional port names. When omitted, the
prefix is derived from uniquify or the interface's runtime type.
Implementation
@experimental
InterfaceType addStructuredInterface<InterfaceType extends Interface<TagType>,
TagType extends Enum>(
InterfaceType source, {
Iterable<TagType>? inputTags,
Iterable<TagType>? outputTags,
Iterable<TagType>? inOutTags,
String Function(String original)? uniquify,
String? name,
}) {
final target = source.clone() as InterfaceType;
final registrations = target.connectIOAsStructuredPorts(
this,
source,
inputTags: inputTags,
outputTags: outputTags,
inOutTags: inOutTags,
uniquify: uniquify,
name: name,
);
_structuredInterfacePortBindings.addAll(
registrations.map(
(registration) => StructuredInterfacePortBinding(
sourceInterface: registration.sourceInterface,
internalInterface: registration.internalInterface,
inputPort: registration.inputPort,
outputPort: registration.outputPort,
),
),
);
return target;
}