Repository: apple/swift-nio
File: Sources/NIOCore/EventLoop.swift (Swift)

Code before:
    @preconcurrency
    @discardableResult
    func scheduleCallback(
        at deadline: NIODeadline,
        handler: some (NIOScheduledCallbackHandler & Sendable)
    ) throws -> NIOScheduledCallback

    /// Schedule a callback after given time.
    ///
    /// - NOTE: Event loops that provide a custom scheduled callback implementation **must** also implement
    ///         `cancelScheduledCallback`. Failure to do so will result in a runtime error.
    @preconcurrency
    @discardableResult
    func scheduleCallback(
        in amount: TimeAmount,
        handler: some (NIOScheduledCallbackHandler & Sendable)
    ) throws -> NIOScheduledCallback

    /// Cancel a scheduled callback.
    ///
    /// - NOTE: Event loops only need to implemented this if they provide a custom scheduled callback implementation.
    func cancelScheduledCallback(_ scheduledCallback: NIOScheduledCallback)
}

extension EventLoop {
    /// Default implemnetation of `now`: Returns `NIODeadline.now()`.
    public var now: NIODeadline { .now() }
}

extension EventLoop {
    /// Default implementation of `makeSucceededVoidFuture`: Return a fresh future (which will allocate).
    public func makeSucceededVoidFuture() -> EventLoopFuture<Void> {
        EventLoopFuture(eventLoop: self, value: ())
    }

    public func _preconditionSafeToWait(file: StaticString, line: UInt) {
        self.preconditionNotInEventLoop(file: file, line: line)
    }

    /// Default implementation of `_promiseCreated`: does nothing.
    public func _promiseCreated(futureIdentifier: _NIOEventLoopFutureIdentifier, file: StaticString, line: UInt) {
        return
    }

    /// Default implementation of `_promiseCompleted`: does nothing.
    public func _promiseCompleted(futureIdentifier: _NIOEventLoopFutureIdentifier) -> (file: StaticString, line: UInt)?
    {
        nil
    }
}


Review comment (suggestion):
```suggestion
    /// Default implementation of `now`: Returns `NIODeadline.now()`.
```

Code after:
    @preconcurrency
    @discardableResult
    func scheduleCallback(
        at deadline: NIODeadline,
        handler: some (NIOScheduledCallbackHandler & Sendable)
    ) throws -> NIOScheduledCallback

    /// Schedule a callback after given time.
    ///
    /// - NOTE: Event loops that provide a custom scheduled callback implementation **must** also implement
    ///         `cancelScheduledCallback`. Failure to do so will result in a runtime error.
    @preconcurrency
    @discardableResult
    func scheduleCallback(
        in amount: TimeAmount,
        handler: some (NIOScheduledCallbackHandler & Sendable)
    ) throws -> NIOScheduledCallback

    /// Cancel a scheduled callback.
    ///
    /// - NOTE: Event loops only need to implemented this if they provide a custom scheduled callback implementation.
    func cancelScheduledCallback(_ scheduledCallback: NIOScheduledCallback)
}

extension EventLoop {
    /// Default implementation of `now`: Returns `NIODeadline.now()`.
    public var now: NIODeadline { .now() }
}

extension EventLoop {
    /// Default implementation of `makeSucceededVoidFuture`: Return a fresh future (which will allocate).
    public func makeSucceededVoidFuture() -> EventLoopFuture<Void> {
        EventLoopFuture(eventLoop: self, value: ())
    }

    public func _preconditionSafeToWait(file: StaticString, line: UInt) {
        self.preconditionNotInEventLoop(file: file, line: line)
    }

    /// Default implementation of `_promiseCreated`: does nothing.
    public func _promiseCreated(futureIdentifier: _NIOEventLoopFutureIdentifier, file: StaticString, line: UInt) {
        return
    }

    /// Default implementation of `_promiseCompleted`: does nothing.
    public func _promiseCompleted(futureIdentifier: _NIOEventLoopFutureIdentifier) -> (file: StaticString, line: UInt)?
    {
        nil
    }
}