structSchema
fun <T> structSchema(typeName: String, block: StructSchemaBuilder<T>.() -> Unit): StructSchema<T>(source)
Builds a StructSchema for T by declaring its fields in wire order.
val translation2d = structSchema<Translation2d>("Translation2d") {
float64("x") { it.x }
float64("y") { it.y }
}
val pose2d = structSchema<Pose2d>("Pose2d") {
struct("translation", translation2d) { it.translation }
struct("rotation", rotation2d) { it.rotation }
}Content copied to clipboard
Throws
if a name is not a valid identifier, a field name repeats, no fields are declared, or two nested schemas share a type name but differ.