Skip to content

AnyPattern

kareman edited this page Aug 23, 2020 · 5 revisions

AnyPattern

A type erased wrapper around a pattern. Can be used to store patterns in arrays and non-generic variables.

public struct AnyPattern<Input: BidirectionalCollection>: Pattern where Input.Element: Hashable

Inheritance

ExpressibleByExtendedGraphemeClusterLiteral, ExpressibleByStringInterpolation, ExpressibleByStringLiteral, ExpressibleByUnicodeScalarLiteral, Pattern

Initializers

init(_:)

public init<P: Pattern>(_ p: P) where Input == P.Input

init(_:)

@inlinable public init(_ p: AnyPattern)

init(_:)

public init(_ p: Literal<Input>)

Properties

_instructions

let _instructions: (inout ContiguousArray<Instruction<Input>>) throws -> Void

_description

let _description: () -> String

description

var description: String

wrapped

The wrapped pattern. If you know the exact type you can unwrap it again.

let wrapped: Any

Methods

createInstructions(_:)

@inlinable public func createInstructions(_ instructions: inout ContiguousArray<Instruction<Input>>) throws

==(lhs:rhs:)

public static func ==(lhs: AnyPattern, rhs: AnyPattern) -> Bool
Clone this wiki locally