Package-level declarations
Types
This Flow will have behaviour very similar to SharedFlow, but there are several differences:
ExceptionHandler wrapper which was created to make possible to use handler across all coroutines calls
This key can (and will) be used to get ContextSafelyExceptionHandler from coroutineContext of suspend functions and in ContextSafelyExceptionHandler for defining of its CoroutineContext.Element.key
A builder for creating multiple deferred computations that can be executed, with only the first completing one being used. This is useful for race conditions where you want the result of whichever computation finishes first.
kotlinx.coroutines.flow.Flow-based android.view.ViewGroup.OnHierarchyChangeListener
Combining globalRWLocker and internal map of SmartRWLocker associated by T to provide next logic:
It is interface which will work like classic Mutex, but in difference have lockStateFlow for listening of the SmartMutex state.
Composite mutex which works with next rules:
It is interface which will work like classic Semaphore, but in difference have permitsStateFlow for listening of the SmartSemaphore state.
Properties
Wraps this value in a completed Deferred. The resulting Deferred is immediately completed with this value. Useful for converting synchronous values to Deferred in contexts that expect deferred values.
This instance will be used in all calls of safely where exception handler has not been passed
This instance will be used in all calls of safelyWithoutExceptions as an exception handler for safely call
Use this handler in cases you wish to include handling of exceptions by defaultSafelyWithoutExceptionHandler and returning null at one time
Functions
Creates AccumulatorFlow using this with receiveAsFlow to get
Creates AccumulatorFlow using this as base Flow
Creates an actor-style channel that processes messages asynchronously based on markers. Messages with the same marker will be processed sequentially, while messages with different markers can be processed concurrently.
Creates a new async coroutine with automatic exception logging. If an exception occurs, it will be logged using the provided logger and then rethrown when the Deferred is awaited.
Trying to Deferred.await on all deferreds. The first Deferred completed its work will interrupt all others awaits and, if cancelOthers passed as true (by default), will also cancel all the others deferreds
Trying to Deferred.await on all deferreds. The first Deferred completed its work will interrupt all others awaits and, if cancelOnResult passed as true (by default), will also cancel all the others deferreds
Trying to Deferred.await on all thiss. The first Deferred completed its work will interrupt all others awaits and, if cancelOthers passed as true (by default), will also cancel all the others Deferreds
Trying to Deferred.await on all thiss. The first Deferred completed its work will interrupt all others awaits and, if cancelOnResult passed as true (by default), will also cancel all the others Deferreds
Trying to Deferred.await on all thiss. The first Deferred completed its work will interrupt all others awaits and, if cancelOnResult passed as true (by default), will also cancel all the others Deferreds
Creates a DeferredAction from this Deferred and a callback function.
Planned to use with doWithSuspending. Will execute incoming lambdas sequentially
Planned to use with doWithSuspending. Will execute incoming lambdas sequentially
Debounces a Flow with per-marker timeout control. Values with the same marker will be debounced independently. For each marker, only the last value within the timeout period will be emitted.
Debounces a Flow with a fixed timeout in milliseconds and per-marker control. Values with the same marker will be debounced independently.
Debounces a Flow with a fixed timeout as Duration and per-marker control. Values with the same marker will be debounced independently.
Executes the given block on the Default dispatcher and returns its result. This is a convenience function for executing CPU-intensive operations.
Call this method in case you need to do something in common thread (like reading of file in JVM)
Alias for launchSynchronously. Launches a coroutine in a new scope and blocks the current thread until it completes.
Alias for launchSynchronously. Launches a coroutine and blocks the current thread until it completes.
Must be use with actor created by createActionsActor or createSafeActionsActor. Will send lambda which will execute action and return result.
Alias for takeNotNull. Filters out null values from this Flow, returning only non-null elements.
Returns the first non-null element emitted by this Flow. Suspends until a non-null element is found.
Builds multiple deferred computations using DoWithFirstBuilder and returns the value of the first one to complete. Other deferred computations are cancelled if cancelOnResult is true.
Returns the value of the first Deferred from the given variants to complete. Other deferred values are cancelled if cancelOnResult is true.
Transforms each element from inner Iterables using the given mapper function and flattens the result into a single Flow.
Transforms each inner Flow element using the given mapper function and flattens the result into a single Flow.
Transforms each element from inner Iterables using the given mapper function, flattens the result, and filters out null values.
Transforms each inner Flow element using the given mapper function, flattens the result, and filters out null values.
Invokes the first DeferredAction from the given variants whose deferred value completes, executing its callback and returning the result. Other deferred actions are cancelled if cancelOnResult is true.
Invokes the first DeferredAction whose deferred value completes, executing its callback and returning the result. Other deferred actions are cancelled if cancelOnResult is true.
Awaits the first Deferred from the given variants to complete and invokes the callback on its value. Other deferred values are cancelled if cancelOnResult is true.
Builds multiple deferred computations using DoWithFirstBuilder and invokes callback on the first one to complete. Other deferred computations are cancelled if cancelOnResult is true.
Trying to Job.join on all jobs. The first Job completed its work will interrupt all others joins and, if cancelOthers passed as true (by default), will also cancel all the others Jobs
Trying to Job.join on all thiss. The first Job completed its work will interrupt all others joins and, if cancelOthers passed as true (by default), will also cancel all the others Jobs
Launches a coroutine in the current thread using Dispatchers.Unconfined and blocks until it completes, returning its result. The coroutine will start execution in the current thread and will continue in the same thread until the first suspension point.
Launches a new coroutine with automatic exception logging. If an exception occurs, it will be logged using the provided logger and then rethrown.
Launches a new coroutine with automatic exception logging and dropping. If an exception occurs, it will be logged using the provided logger and then dropped (not rethrown), allowing the coroutine to complete normally.
Launches a coroutine in a new CoroutineScope with Dispatchers.Default and blocks the current thread until the coroutine completes, returning its result.
Launches a coroutine and blocks the current thread until the coroutine completes, returning its result. This is useful for bridging between suspending and non-suspending code in JVM environments. The coroutine is launched with CoroutineStart.UNDISPATCHED to start execution immediately.
Creates a SupervisorJob linked to this CoroutineContext's job. The new supervisor job will be a child of the current job, and optionally combined with additionalContext.
Creates a SupervisorJob linked to this CoroutineScope's job. The new supervisor job will be a child of the current scope's job, and optionally combined with additionalContext.
Creates a new CoroutineScope with a SupervisorJob linked to this CoroutineContext's job. The new scope's supervisor job will be a child of the current job, and optionally combined with additionalContext.
Creates a new CoroutineScope with a SupervisorJob linked to this CoroutineScope's job. The new scope's supervisor job will be a child of the current scope's job, and optionally combined with additionalContext.
Replaces a failed Result with a new value computed from the exception. If this Result is successful, it is returned as-is. If it represents a failure, the onException handler is called with the exception to compute a replacement value, which is then wrapped in a new Result.
Creates a safe actor that catches and handles exceptions during message processing. This variant wraps the processing logic in a safety mechanism to prevent actor failure due to exceptions.
Use ViewGroup.setOnHierarchyChangeListener recursively for all available ViewGroups starting with this. This extension DO NOT guarantee that recursive subscription will happen after this method call
Subscribes to a Flow with asynchronous processing based on markers. Each value from the flow will be processed by the block function. Values with the same marker will be processed sequentially in the same coroutine scope, while values with different markers can be processed concurrently in separate coroutine scopes.
Use subscribeSafelyWithoutExceptions, but all exceptions will be passed to defaultSafelyExceptionHandler
Subscribes to a Flow with asynchronous processing based on markers, automatically logging and dropping exceptions. Each value from the flow will be processed by the block function. Values with the same marker will be processed sequentially, while values with different markers can be processed concurrently. Any exceptions thrown during processing will be logged and dropped without affecting other messages.
Ensures that the current coroutine context is still active and throws a kotlinx.coroutines.CancellationException if the coroutine has been canceled.
Filters out null values from this Flow, returning only non-null elements.
Will wait until the SmartSemaphore.permitsStateFlow of this instance will have permits count free permits.
Will wait until the SmartSemaphore.permitsStateFlow of this instance will have permits count free permits.
Will wait until the SmartMutex.lockStateFlow of this instance will be false.
Will wait until the SmartMutex.lockStateFlow of this instance will be false.
Created CoroutineScope which will launch listening of context job completing and drop itself. Current weak scope will not be attached to context directly. So, this CoroutineScope will not prevent parent one from cancelling if it is launched with supervisorScope or coroutineScope, but still will follow closing status of parent Job
Created CoroutineScope which will launch listening of scope job completing and drop itself. Current weak scope will not be attached to scope directly. So, this CoroutineScope will not prevent parent one from cancelling if it is launched with supervisorScope or coroutineScope, but still will follow closing status of parent Job
Will call SmartSemaphore.Mutable.lock, then execute action and return the result after SmartSemaphore.Mutable.unlock
Will call SmartMutex.Mutable.lock, then execute action and return the result after SmartMutex.Mutable.unlock
Will call SmartSemaphore.Mutable.lock, then execute action and return the result after SmartSemaphore.Mutable.unlock
Will call SmartMutex.Mutable.lock, then execute action and return the result after SmartMutex.Mutable.unlock