Attributes
- Companion
- object
- Graph
-
- Supertypes
-
trait Enumtrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Members list
Type members
Value members
Concrete methods
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")