@@ -304,7 +304,8 @@ public class P4StructValue: P4DataValue {
|
||||
}
|
||||
|
||||
public init(withType type: P4Struct, andInitializers initializers: [P4Value?]) {
|
||||
let values: [P4Value?] = zip(0..<type.fields.count(), type.fields.fields).map { (index, field) in
|
||||
let values: [P4Value?] = zip(0..<type.fields.count(), type.fields.fields).map {
|
||||
(index, field) in
|
||||
// If there is an initializer for the field, then use it.
|
||||
if index < initializers.count, let initializer = initializers[index] {
|
||||
initializer
|
||||
|
||||
@@ -81,7 +81,7 @@ public struct Errors: Errorable, CustomStringConvertible {
|
||||
}
|
||||
|
||||
public var description: String {
|
||||
return self.errors.map() { error in
|
||||
return self.errors.map { error in
|
||||
return error.msg()
|
||||
}.joined(separator: ";")
|
||||
}
|
||||
|
||||
@@ -89,7 +89,9 @@ public func Map<T, U>(input: T, block: (T) -> U) -> U {
|
||||
|
||||
@freestanding(expression) public macro RequireOkResult<T>(_: Result<T>) -> Bool =
|
||||
#externalMacro(module: "Macros", type: "RequireResult")
|
||||
@freestanding(expression) public macro RequireErrorResult<T>(_: any Errorable, _: Result<T>) -> Bool =
|
||||
@freestanding(expression) public macro RequireErrorResult<T>(
|
||||
_: any Errorable, _: Result<T>
|
||||
) -> Bool =
|
||||
#externalMacro(module: "Macros", type: "RequireErrorResult")
|
||||
@freestanding(expression) public macro UseOkResult<T>(_: Result<T>) -> T =
|
||||
#externalMacro(module: "Macros", type: "UseOkResult")
|
||||
|
||||
Reference in New Issue
Block a user