This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // from https://github.com/apple/swift-log/blob/main/Sources/Logging/MetadataProvider.swift#L15 | |
| #if canImport(Darwin) // macOS, iOS, tvOS, visionOS, ... | |
| import Darwin | |
| #elseif os(Windows) | |
| import CRT | |
| #elseif canImport(Glibc) // vanilla linux | |
| import Glibc | |
| #elseif canImport(Android) | |
| import Android | |
| #elseif canImport(Musl) // ...The Static Linux SDK does not use Glibc; instead, it is built on top of an alternative C library for Linux called Musl... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| protocol BaseProtocol { | |
| associatedtype Base | |
| func export(base: Base) -> String | |
| } | |
| protocol ExtendedProtocol: BaseProtocol { | |
| associatedtype Left | |
| associatedtype Right | |
| typealias Base = (left: Left, right: Right) // associatedtype requirement must be satisfied here |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| protocol SequenceYouCanInsertInto: Sequence { | |
| init() | |
| mutating func mySuperInsert(_ element: Iterator.Element) | |
| } | |
| extension Sequence { | |
| func mySuperFilter<T: SequenceYouCanInsertInto>(_ predicate: (Iterator.Element) throws -> Bool) rethrows -> T where Iterator.Element == T.Iterator.Element { | |
| var result = T() | |
| for value in self { |