import Ch23Kit @main struct Ch23Demo { static func main() async { let counter = try? await StreamLab.collect(CounterSequence(1...3)) print("[23.1] 自定义序列 = \(counter ?? [])") let unbounded = try? await StreamLab.collect(StreamLab.bridgeUnbounded()) print("[23.2] unbounded = \(unbounded ?? [])") let newest = try? await StreamLab.collect(StreamLab.bridgeNewestOne()) print("[23.3] bufferingNewest(1) = \(newest ?? [])") let evens = try? await StreamLab.collectFiltered(CounterSequence(1...10)) { $0 % 2 == 0 } print("[23.4] filter 偶数 = \(evens ?? [])") let prefix = try? await StreamLab.collectPrefix(CounterSequence(1...10), count: 3) print("[23.4] prefix(3) = \(prefix ?? [])") let fast = await TimeoutLab.collect(CounterSequence(1...3), timeout: .milliseconds(200)) print("[23.5] 快速序列 = \(fast)") let slow = await TimeoutLab.collect( TimeoutLab.slowSequence(count: 3), timeout: .milliseconds(20)) print("[23.5] 超时结果 = \(slow)") print("[23.6] MemoryLayout> = \(MemoryLayout>.size) 字节") print("[23.6] MemoryLayout = \(MemoryLayout.size) 字节") } }