scoop:scoop.core:0.1.0
src/unit.scoop
Selected production source · src/unit.scoop
1
/**2
* The zero-sized value returned by operations that have no meaningful result.3
*/4
@Intrinsic("core_unit")5
public struct Unit : Equals<Unit> {6
/**7
* Returns true because all Unit values represent the same zero-sized value.8
*/9
public override operator fun equals(other: Unit): Boolean = true11
/** Default codecs for generic companion constraints, separate from the Unit data value. */12
public companion object : ValueEncoder<Unit>, ValueDecoder<Unit> {13
/** Encodes the Unit value using the existing explicit null codec. */14
public override fun encode(value: Unit, encoder: Encoder): Unit = UnitEncoder.encode(value, encoder)16
/** Decodes an explicit null using the existing Unit codec. */17
public override fun decode(decoder: Decoder): Unit = UnitDecoder.decode(decoder)18
}19
}