@@ -34,19 +34,19 @@ public struct Program {
|
||||
}
|
||||
|
||||
/// Retrieve global instances in the compiled P4 program.
|
||||
///
|
||||
///
|
||||
/// Use the given filter to select which of the global instances
|
||||
/// from the compiled P4 program to retrieve.
|
||||
///
|
||||
///
|
||||
/// If the compiled P4 program (from the source in the
|
||||
/// string `p4_program_with_control_decl`) has two Control
|
||||
/// instances and you only want to select the one named simple,
|
||||
/// you could use a filter like
|
||||
///
|
||||
/// @Snippet(path: "use-program-instanceswithtypes", slice: "include")
|
||||
///
|
||||
/// @Snippet(path: "use-program-instanceswithtypes", slice: "include")
|
||||
///
|
||||
public func InstancesWithTypes(_ filter: TypeFilter) -> [P4Type] {
|
||||
return self.instances.filter() { instance in
|
||||
return self.instances.filter { instance in
|
||||
filter(instance)
|
||||
}
|
||||
}
|
||||
@@ -57,19 +57,19 @@ public struct Program {
|
||||
}
|
||||
|
||||
/// Retrieve global types declared in the compiled P4 program.
|
||||
///
|
||||
///
|
||||
/// Use the given filter to select which of the global types
|
||||
/// declared in the compiled P4 program to retrieve.
|
||||
///
|
||||
///
|
||||
/// If the compiled P4 program (from the source in the
|
||||
/// string `p4_program_with_struct_decl`) has two structs declared and
|
||||
/// you only want to select the one named `agg`, you could
|
||||
/// use a filter like
|
||||
///
|
||||
/// @Snippet(path: "use-program-typeswithtypes", slice: "include")
|
||||
///
|
||||
/// @Snippet(path: "use-program-typeswithtypes", slice: "include")
|
||||
///
|
||||
public func TypesWithTypes(_ filter: TypeFilter) -> [P4Type] {
|
||||
return self.types.filter() { instance in
|
||||
return self.types.filter { instance in
|
||||
filter(instance)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user