JSONSequenceDeserializationSequence
A sequence that parses arbitrary byte chunks into lines using the JSON Sequence format.
JSONSequenceDecoding.swift:24struct JSONSequenceDeserializationSequence<Upstream> where Upstream : Sendable, Upstream : AsyncSequence, Upstream.Element == ArraySlice<UInt8>
Citizens in OpenAPIRuntime
Conformances
Type members
init(upstream: Upstream
) Creates a new sequence.
Citizens in OpenAPIRuntime
where Upstream:AsyncSequence, Upstream:Sendable, Upstream.Element == ArraySlice<UInt8>
Conformances
protocol AsyncSequence<Element, Failure>
A type that provides asynchronous, sequential, iterated access to its elements.
protocol Copyable
A type whose values can be implicitly or explicitly copied.
protocol Escapable
Types
struct Iterator<UpstreamIterator>
The iterator of
JSONSequenceDeserializationSequence
.
Typealiases
Instance members
func makeAsyncIterator(
) -> Iterator<Upstream.AsyncIterator> Creates the asynchronous iterator that produces elements of this asynchronous sequence.
Instance features
func allSatisfy((Self.Element) async throws -> Bool
) async rethrows -> Bool Returns a Boolean value that indicates whether all elements produced by the asynchronous sequence satisfy the given predicate.
func asDecodedJSONLines<Event>(of: Event.Type, decoder: JSONDecoder
) -> AsyncThrowingMapSequence<JSONLinesDeserializationSequence<Self>, Event> Returns another sequence that decodes each JSON Lines event as the provided type using the provided decoder.
func asDecodedJSONSequence<Event>(of: Event.Type, decoder: JSONDecoder
) -> AsyncThrowingMapSequence<JSONSequenceDeserializationSequence<Self>, Event> Returns another sequence that decodes each JSON Sequence event as the provided type using the provided decoder.
func asDecodedServerSentEvents(while: @escaping (ArraySlice<UInt8>) -> Bool
) -> ServerSentEventsDeserializationSequence<ServerSentEventsLineDeserializationSequence<Self>> Returns another sequence that decodes each event’s data as the provided type using the provided decoder.
func asDecodedServerSentEventsWithJSONData<JSONDataType>(of: JSONDataType.Type, decoder: JSONDecoder, while: @escaping (ArraySlice<UInt8>) -> Bool
) -> AsyncThrowingMapSequence<ServerSentEventsDeserializationSequence<ServerSentEventsLineDeserializationSequence<Self>>, ServerSentEventWithJSONData<JSONDataType>> Returns another sequence that decodes each event’s data as the provided type using the provided decoder.
func asEncodedServerSentEvents(
) -> ServerSentEventsSerializationSequence<Self> Returns another sequence that encodes Server-sent Events with generic data in the data field.
func asEncodedServerSentEventsWithJSONData<JSONDataType>(encoder: JSONEncoder
) -> ServerSentEventsSerializationSequence<AsyncThrowingMapSequence<Self, ServerSentEvent>> Returns another sequence that encodes Server-sent Events that have a JSON value in the data field.
func compactMap<ElementOfResult>(@escaping (Self.Element) async -> ElementOfResult?
) -> AsyncCompactMapSequence<Self, ElementOfResult> Creates an asynchronous sequence that maps the given closure over the asynchronous sequence’s elements, omitting results that don’t return a value.
func compactMap<ElementOfResult>(@escaping (Self.Element) async throws -> ElementOfResult?
) -> AsyncThrowingCompactMapSequence<Self, ElementOfResult> Creates an asynchronous sequence that maps an error-throwing closure over the base sequence’s elements, omitting results that don’t return a value.
func contains(Self.Element
) async rethrows -> Bool Returns a Boolean value that indicates whether the asynchronous sequence contains the given element.
func contains(where: (Self.Element) async throws -> Bool
) async rethrows -> Bool Returns a Boolean value that indicates whether the asynchronous sequence contains an element that satisfies the given predicate.
func drop(while: @escaping (Self.Element) async -> Bool
) -> AsyncDropWhileSequence<Self> Omits elements from the base asynchronous sequence until a given closure returns false, after which it passes through all remaining elements.
func dropFirst(Int
) -> AsyncDropFirstSequence<Self> Omits a specified number of elements from the base asynchronous sequence, then passes through all remaining elements.
func filter(@escaping (Self.Element) async -> Bool
) -> AsyncFilterSequence<Self> Creates an asynchronous sequence that contains, in order, the elements of the base sequence that satisfy the given predicate.
func first(where: (Self.Element) async throws -> Bool
) async rethrows -> Self.Element? Returns the first element of the sequence that satisfies the given predicate.
func flatMap<SegmentOfResult>(@escaping (Self.Element) async throws -> SegmentOfResult
) -> AsyncThrowingFlatMapSequence<Self, SegmentOfResult> Creates an asynchronous sequence that concatenates the results of calling the given error-throwing transformation with each element of this sequence.
func flatMap<SegmentOfResult>(@escaping (Self.Element) async -> SegmentOfResult
) -> AsyncFlatMapSequence<Self, SegmentOfResult> Creates an asynchronous sequence that concatenates the results of calling the given transformation with each element of this sequence.
func flatMap<SegmentOfResult>(@escaping (Self.Element) async -> SegmentOfResult
) -> AsyncFlatMapSequence<Self, SegmentOfResult> Creates an asynchronous sequence that concatenates the results of calling the given transformation with each element of this sequence.
func flatMap<SegmentOfResult>(@escaping (Self.Element) async -> SegmentOfResult
) -> AsyncFlatMapSequence<Self, SegmentOfResult> Creates an asynchronous sequence that concatenates the results of calling the given transformation with each element of this sequence.
func map<Transformed>(@escaping (Self.Element) async -> Transformed
) -> AsyncMapSequence<Self, Transformed> Creates an asynchronous sequence that maps the given closure over the asynchronous sequence’s elements.
func map<Transformed>(@escaping (Self.Element) async throws -> Transformed
) -> AsyncThrowingMapSequence<Self, Transformed> Creates an asynchronous sequence that maps the given error-throwing closure over the asynchronous sequence’s elements.
func max(by: (Self.Element, Self.Element) async throws -> Bool
) async rethrows -> Self.Element? Returns the maximum element in the asynchronous sequence, using the given predicate as the comparison between elements.
func min(by: (Self.Element, Self.Element) async throws -> Bool
) async rethrows -> Self.Element? Returns the minimum element in the asynchronous sequence, using the given predicate as the comparison between elements.
func prefix(Int
) -> AsyncPrefixSequence<Self> Returns an asynchronous sequence, up to the specified maximum length, containing the initial elements of the base asynchronous sequence.
func prefix(while: @escaping (Self.Element) async -> Bool
) rethrows -> AsyncPrefixWhileSequence<Self> Returns an asynchronous sequence, containing the initial, consecutive elements of the base sequence that satisfy the given predicate.
func reduce<Result>(Result, (Result, Self.Element) async throws -> Result
) async rethrows -> Result Returns the result of combining the elements of the asynchronous sequence using the given closure.
func reduce<Result>(into: Result, (inout Result, Self.Element) async throws -> Void
) async rethrows -> Result Returns the result of combining the elements of the asynchronous sequence using the given closure, given a mutable initial value.
Show obsolete interfaces (2)
Hide obsolete interfaces
func asDecodedServerSentEvents(
) -> ServerSentEventsDeserializationSequence<ServerSentEventsLineDeserializationSequence<Self>> Returns another sequence that decodes each event’s data as the provided type using the provided decoder.
func asDecodedServerSentEventsWithJSONData<JSONDataType>(of: JSONDataType.Type, decoder: JSONDecoder
) -> AsyncThrowingMapSequence<ServerSentEventsDeserializationSequence<ServerSentEventsLineDeserializationSequence<Self>>, ServerSentEventWithJSONData<JSONDataType>> Returns another sequence that decodes each event’s data as the provided type using the provided decoder.