asLongState

Function

Common
public fun State<Long>.asLongState(): LongState

Converts a State<Long> (as in, a State of boxed Longs) into a primitive-backed LongState. The state will be automatically unboxed to the required primitive type. The returned state is read-only. The returned state will mirror the values of the base state and apply updates in the same way as the receiver defines.

On the JVM, this conversion does not avoid the autoboxing that LongState attempts to escape, but instead is intended to allow interoperability between components that use either representation of a state of type Long.