Attributes
- Companion
- object
- Graph
-
- Supertypes
-
class Ref[Computation, S]trait RefSink[Computation, S]trait RefSource[Computation, S]trait Serializableclass Objecttrait Matchableclass AnyShow all
Members list
Value members
Concrete methods
Obtains a snapshot of the current value, and a setter for updating it.
Obtains a snapshot of the current value, and a setter for updating it.
The setter attempts to modify the contents from the snapshot to the new value (and return true
). If it cannot do this (because the contents changed since taking the snapshot), the setter is a noop and returns false
.
Satisfies: r.access.map(_._1) == r.get
and r.access.flatMap { case (v, setter) => setter(f(v)) } == r.tryUpdate(f).map(_.isDefined)
.
Attributes
- Definition Classes
-
Ref
Obtains the current value.
Obtains the current value.
Since Ref
is always guaranteed to have a value, the returned action completes immediately after being bound.
Attributes
- Definition Classes
-
RefSource
Like tryModify
but retries until the update has been successfully made.
Like tryModify
but retries until the update has been successfully made.
Attributes
- Definition Classes
-
Ref
Like tryModifyState but retries the modification until successful.
Like tryModifyState but retries the modification until successful.
Attributes
- Definition Classes
-
Ref
Sets the current value to a
.
Sets the current value to a
.
The returned action completes after the reference has been successfully set.
Attributes
- Definition Classes
-
RefSink
Like tryUpdate
but allows the update function to return an output value of type B
. The returned action completes with None
if the value is not updated successfully and Some(b)
otherwise.
Like tryUpdate
but allows the update function to return an output value of type B
. The returned action completes with None
if the value is not updated successfully and Some(b)
otherwise.
Attributes
- Definition Classes
-
Ref
Update the value of this Ref
with a state computation.
Update the value of this Ref
with a state computation.
The current value of this Ref
is used as the initial state and the computed output state is stored in this Ref
after computation completes. If a concurrent modification occurs, None
is returned.
Attributes
- Definition Classes
-
Ref
Attempts to modify the current value once, returning false
if another concurrent modification completes between the time the variable is read and the time it is set.
Attempts to modify the current value once, returning false
if another concurrent modification completes between the time the variable is read and the time it is set.
Attributes
- Definition Classes
-
Ref
Modifies the current value using the supplied update function. If another modification occurs between the time the current value is read and subsequently updated, the modification is retried using the new value. Hence, f
may be invoked multiple times.
Modifies the current value using the supplied update function. If another modification occurs between the time the current value is read and subsequently updated, the modification is retried using the new value. Hence, f
may be invoked multiple times.
Satisfies: r.update(_ => a) == r.set(a)
Attributes
- Definition Classes
-
Ref
Inherited methods
Like modify but schedules resulting effect right after modification.
Like modify but schedules resulting effect right after modification.
Useful for implementing effectful transition of a state machine, in which an effect is performed based on current state and the state must be updated to reflect that this effect will be performed.
Both modification and finalizer are within a single uncancelable region, to prevent canceled finalizers from leaving the Ref's value permanently out of sync with effects actually performed. if you need cancellation mechanic in finalizer please see flatModifyFull.
Attributes
- See also
-
modify
flatModifyFull
- Inherited from:
- Ref
Like modify but schedules resulting effect right after modification.
Like modify but schedules resulting effect right after modification.
Unlike flatModify finalizer cancellation could be unmasked via supplied Poll
. Modification itself is still uncancelable.
When used as part of a state machine, cancelable regions should usually have an onCancel
finalizer to update the state to reflect that the effect will not be performed.
Attributes
- See also
-
modify
flatModify
- Inherited from:
- Ref
Like modifyState but schedules resulting effect right after state computation & update.
Like modifyState but schedules resulting effect right after state computation & update.
Both modification and finalizer are uncancelable, if you need cancellation mechanic in finalizer please see flatModifyStateFull.
Attributes
- See also
-
modifyState
flatModifyStateFull
- Inherited from:
- Ref
Like modifyState but schedules resulting effect right after modification.
Like modifyState but schedules resulting effect right after modification.
Unlike flatModifyState finalizer cancellation could be masked via supplied Poll[F]
. Modification itself is still uncancelable.
Attributes
- See also
-
modifyState
flatModifyState
- Inherited from:
- Ref
Replaces the current value with a
, returning the previous value.
Replaces the current value with a
, returning the previous value.
Attributes
- Inherited from:
- Ref
Updates the current value using f
and returns the previous value.
Updates the current value using f
and returns the previous value.
In case of retries caused by concurrent modifications, the returned value will be the last one before a successful update.
Attributes
- Inherited from:
- Ref
Modify the context F
using transformation f
.
Modify the context F
using transformation f
.
Attributes
- Inherited from:
- Ref
Updates the current value using f
, and returns the updated value.
Updates the current value using f
, and returns the updated value.
Attributes
- Inherited from:
- Ref