Skip to content

Commit

Permalink
Add inlining
Browse files Browse the repository at this point in the history
  • Loading branch information
stephencelis committed May 4, 2022
1 parent 403c985 commit 9d9d3bf
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Sources/_URLRouting/Path.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ where ComponentParser.Input == Substring {
self.componentParser = componentParser
}

@inlinable
public func parse(_ input: inout URLRequestData) throws -> ComponentParser.Output {
guard input.path.count >= 1 else { throw RoutingError() }
return try self.componentParser.parse(input.path.removeFirst())
}
}

extension PathComponent: ParserPrinter where ComponentParser: ParserPrinter {
@inlinable
public func print(_ output: ComponentParser.Output, into input: inout URLRequestData) rethrows {
try input.path.prepend(self.componentParser.print(output))
}
Expand Down

0 comments on commit 9d9d3bf

Please sign in to comment.