GeneratedEnum

nscn.polaris2.protoc.runtime.GeneratedEnum

Base trait of every generated proto enum.

Generated as a Scala 3 enum whose cases carry their proto number, plus an Unrecognized case:

enum Color(val value: Int) extends GeneratedEnum derives CanEqual:
 case COLOR_UNKNOWN extends Color(0)
 case COLOR_RED     extends Color(1)
 case Unrecognized(unrecognizedValue: Int) extends Color(unrecognizedValue)

Unrecognized is present even on a closed enum, so the API does not change shape with the enum's openness. Parsing a closed enum never produces it - an out-of-range value there belongs in the unknown fields, which is what editions mandates - so it can only come from an explicit GeneratedEnumCompanion.fromValue call.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def index: Int

Position among the declared values, or -1 for Unrecognized.

Position among the declared values, or -1 for Unrecognized.

Attributes

def name: String

The name as written in the .proto file, which a Scala rename does not change.

The name as written in the .proto file, which a Scala rename does not change.

Attributes

def value: Int

The number this value has on the wire.

The number this value has on the wire.

Attributes

Concrete methods

final def isUnrecognized: Boolean
final def javaValueDescriptor: EnumValueDescriptor

The descriptor of this value.

The descriptor of this value.

Throws for Unrecognized: protoc never emitted a descriptor for a number that is not in the enum.

Attributes