You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remove unbounded strategy, rename copy -> makeAdditionalSource, rename asyncSequence() -> elements(), and move enqueue and cancel to the CallbackHandle previously called CallbackToken
/// A type that indicates the result of sending elements to the source.
584
584
publicenumSendResult: ~Copyable, Sendable {
585
-
///An opaque token that is returned when the channel's backpressure strategy indicated that production should
586
-
/// be suspended. Use this token to enqueue a callback by calling the ``MultiProducerSingleConsumerAsyncChannel/Source/enqueueCallback(callbackToken:onProduceMore:)`` method.
585
+
///A handle that is returned when the channel's backpressure strategy indicated that production should
586
+
/// be suspended. Use this handle to enqueue a callback by calling the ``CallbackHandle/enqueueCallback(onProduceMore:)`` method.
587
587
///
588
-
/// - Important: This token must only be passed once to ``MultiProducerSingleConsumerAsyncChannel/Source/enqueueCallback(callbackToken:onProduceMore:)``
589
-
/// and ``MultiProducerSingleConsumerAsyncChannel/Source/cancelCallback(callbackToken:)``.
590
-
publicstructCallbackToken: Sendable, Hashable{ }
588
+
/// - Important: ``CallbackHandle/enqueueCallback(onProduceMore:)`` and ``CallbackHandle/cancelCallback()`` must
589
+
/// only be called once.
590
+
publicstructCallbackHandle: Sendable, Hashable{
591
+
/// Enqueues a callback that will be invoked once more elements should be produced.
592
+
///
593
+
/// - Important: Calling enqueue more than once is **not allowed**.
594
+
///
595
+
/// - Parameters:
596
+
/// - onProduceMore: The callback which gets invoked once more elements should be produced.
/// - Note: This methods supports being called before ``enqueueCallback(onProduceMore:)`` is called.
605
+
///
606
+
/// - Important: Calling enqueue more than once is **not allowed**.
607
+
@inlinable
608
+
publicmutatingfunccancelCallback()
609
+
}
591
610
592
611
/// Indicates that more elements should be produced and send to the source.
593
612
caseproduceMore
594
613
595
614
/// Indicates that a callback should be enqueued.
596
-
///
597
-
/// The associated token should be passed to the ````MultiProducerSingleConsumerAsyncChannel/Source/enqueueCallback(callbackToken:onProduceMore:)```` method.
598
-
caseenqueueCallback(CallbackToken)
615
+
caseenqueueCallback(CallbackHandle)
599
616
}
600
617
601
618
/// A callback to invoke when the channel finished.
Copy file name to clipboardExpand all lines: Sources/AsyncAlgorithms/MultiProducerSingleConsumerChannel/MultiProducerSingleConsumerAsyncChannel+Internal.swift
0 commit comments