Coverage Report

Created: 2026-06-15 07:01

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/grpc-swift/Sources/GRPC/AsyncAwaitSupport/GRPCAsyncWriterSinkDelegate.swift
Line
Count
Source
1
/*
2
 * Copyright 2022, gRPC Authors All rights reserved.
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
import DequeModule
17
import NIOCore
18
19
@usableFromInline
20
internal struct GRPCAsyncWriterSinkDelegate<Element: Sendable>: NIOAsyncWriterSinkDelegate {
21
  @usableFromInline
22
  let _didYield: (@Sendable (Deque<Element>) -> Void)?
23
24
  @usableFromInline
25
  let _didTerminate: (@Sendable (Error?) -> Void)?
26
27
  @inlinable
28
  init(
29
    didYield: (@Sendable (Deque<Element>) -> Void)? = nil,
30
    didTerminate: (@Sendable (Error?) -> Void)? = nil
31
0
  ) {
32
0
    self._didYield = didYield
33
0
    self._didTerminate = didTerminate
34
0
  }
35
36
  @inlinable
37
0
  func didYield(contentsOf sequence: Deque<Element>) {
38
0
    self._didYield?(sequence)
39
0
  }
40
41
  @inlinable
42
0
  func didTerminate(error: Error?) {
43
0
    self._didTerminate?(error)
44
0
  }
45
}