Swiftコード
func foo(g: @escaping () -> Void) {}
@_optimize(none)
func sink<X>(_ x: X) {}
func main(a: Int) {
foo { [a] () in| import SwiftUI | |
| @Observable | |
| final class Controller { | |
| init() {} | |
| let cooldown0 = 0.2 | |
| let cooldown1 = 0.2 | |
| var showsAlert: Bool = false |
Swiftコード
func foo(g: @escaping () -> Void) {}
@_optimize(none)
func sink<X>(_ x: X) {}
func main(a: Int) {
foo { [a] () in| import Foundation | |
| struct TimeoutError: Error {} | |
| extension Result where Failure == any Error { | |
| init(catching: () async throws -> Success) async { | |
| do { | |
| self = .success(try await catching()) | |
| } catch { | |
| self = .failure(error) |
| import Foundation | |
| struct TimeoutError: Error {} | |
| extension Result where Failure == any Error { | |
| init(catching: () async throws -> Success) async { | |
| do { | |
| self = .success(try await catching()) | |
| } catch { | |
| self = .failure(error) |
| struct TimeoutError: Error {} | |
| // 記事のコードそのまま | |
| func runWithTimeout<T>( | |
| timeout: Duration, | |
| _ operation: @Sendable () async throws -> T | |
| ) async throws -> T { | |
| return try await withoutActuallyEscaping(operation) { operation in | |
| return try await withThrowingTaskGroup(of: T?.self) { g in | |
| g.addTask(operation: operation) |
| protocol Middleware<Input, Output, NextInput, NextOutput> { | |
| associatedtype Input | |
| associatedtype Output | |
| associatedtype NextInput | |
| associatedtype NextOutput | |
| } | |
| protocol Routes<Input, Output> { | |
| associatedtype Input | |
| associatedtype Output |
| import { Auth } from "@firebase/auth"; | |
| import * as firebaseui from "firebaseui"; | |
| import { ReactElement, useEffect, useRef, useState } from "react"; | |
| import { Random } from "../../components/Random"; | |
| import { Box, BoxProps } from "@chakra-ui/react"; | |
| export type FirebaseAuthViewProps = { | |
| auth: Auth; | |
| config: firebaseui.auth.Config; | |
| } & BoxProps; |
| extension YearMonthDay: PostgresDataConvertible { | |
| public static var postgresDataType: PostgresDataType { | |
| .date | |
| } | |
| public init?(postgresData: PostgresData) { | |
| guard let date = postgresData.date else { | |
| return nil | |
| } | |
| self.init(date: date, calendar: .gregorian, timeZone: .gmt) |