Move envelope builder to the top level.
This commit is contained in:
parent
221cc65b78
commit
17c9bf3d54
@ -8,6 +8,7 @@
|
||||
- `ListValue` and `DoubleArrayValue` implement `Iterable`.
|
||||
- Changed the logic of `Value::isList` to check for type instead of size
|
||||
- `Meta{}` builder made inline
|
||||
- Moved `Envelope` builder to a top level function. Companion invoke is deprecated.
|
||||
|
||||
### Deprecated
|
||||
|
||||
|
@ -29,6 +29,9 @@ public interface Envelope {
|
||||
/**
|
||||
* Build a static envelope using provided builder
|
||||
*/
|
||||
@Deprecated("Use top level function instead",
|
||||
replaceWith = ReplaceWith("Envelope(block)", "hep.dataforge.io.Envelope")
|
||||
)
|
||||
public inline operator fun invoke(block: EnvelopeBuilder.() -> Unit): Envelope =
|
||||
EnvelopeBuilder().apply(block).seal()
|
||||
}
|
||||
|
@ -44,6 +44,12 @@ public class EnvelopeBuilder : Envelope {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Build a static envelope using provided [builder]
|
||||
*/
|
||||
public inline fun Envelope(builder: EnvelopeBuilder.() -> Unit): Envelope = EnvelopeBuilder().apply(builder).seal()
|
||||
|
||||
//@ExperimentalContracts
|
||||
//suspend fun EnvelopeBuilder.buildData(block: suspend Output.() -> Unit): Binary{
|
||||
// contract {
|
||||
|
@ -136,7 +136,7 @@ public fun Meta.builder(): MetaBuilder {
|
||||
/**
|
||||
* Create a deep copy of this meta and apply builder to it
|
||||
*/
|
||||
public fun Meta.edit(builder: MetaBuilder.() -> Unit): MetaBuilder = builder().apply(builder)
|
||||
public inline fun Meta.edit(builder: MetaBuilder.() -> Unit): MetaBuilder = builder().apply(builder)
|
||||
|
||||
/**
|
||||
* Build a [MetaBuilder] using given transformation
|
||||
|
Loading…
Reference in New Issue
Block a user