Attributes
- Companion
- enum
- Graph
-
- Supertypes
-
trait Sumtrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
OutputDatum.type
Members list
Type members
Inherited and Abstract types
The names of the product elements
The names of the product elements
Attributes
- Inherited from:
- Mirror
The name of the type
The name of the type
Attributes
- Inherited from:
- Mirror
Value members
Givens
Givens
Extensions
Extensions
Extracts the inline datum and decodes it as A.
Extracts the inline datum and decodes it as A.
Fails the script when the datum is not inline (NoOutputDatum or OutputDatumHash). This replaces the common pattern
output.datum match
case OutputDatum.OutputDatum(d) => d.to[MyDatum]
case _ => fail("Expected inline datum")
with output.datum.inlineOrFail[MyDatum].
Being inline, the match is checked against the receiver's static type: calling this on a receiver the compiler already knows is NoOutputDatum or OutputDatumHash is rejected at compile time instead of failing at run time.
Type parameters
- A
-
the datum type to decode with its
FromDatainstance
Attributes
- Example
-
val datum = output.datum.inlineOrFail[CampaignDatum]
Extracts the inline datum and decodes it as A, failing with message when the datum is not inline.
Extracts the inline datum and decodes it as A, failing with message when the datum is not inline.
Type parameters
- A
-
the datum type to decode with its
FromDatainstance
Attributes
- Example
-
val datum = output.datum.inlineOrFail[CampaignDatum]("Campaign must have inline datum")