枚举 Lua的不可变枚举类型。 用法 local Enum = require " enum " -- Enums can be created like so: local Number = Enum ( " Zero " , " One " , " Two " , " Three " ) -- To control the starting value of an enum, the first value can be set. local States = Enum ({ [ " Paused " ] = - 1 , -- Our enum will now start at -1 instead of 0. " Active " , -- > 0 " Win " , -- > 1 " Lose " ,
2022-04-26 10:44:41 6KB lua luajit enums Lua
1
Protoc Gen 打字稿 直接通过TypeScript Compiler API从 Proto 文件生成适当的协议缓冲区源。 该插件生成可用于 AMD、UMD、CommonJS 模块系统的纯Typescript文件。 这个 protoc 插件的目的是通过采用现代方法在 Javascript/Typescript 中轻松使用协议缓冲区。 例子 syntax = "proto3" ; message Change { Kind kind = 1 ; string patch = 2 ; repeated string tags = 3 ; oneof name_or_id { string name = 4 ; string id = 5 ; } } enum Kind { UPDATED = 0 ;
2021-08-03 18:05:04 118KB typescript protocol-buffers grpc enums
1
Dart枚举 Dart 没有对 Enum 的原生支持,这个库试图填补这个空白。 很大程度上受 Java 的枚举特性的启发,这个库提供了一个可扩展的 Enum 类,该类为所有枚举实例提供一个序数和一个名称。 还提供了一个valueOf构造函数和values()可迭代的。 使用示例: class MyEnum extends Enum { // the enum values static const MyEnum nr1 = const MyEnum ._( 5 ); static const MyEnum nr2 = const MyEnum ._( 10 ); static const MyEnum nr3 = const MyEnum ._( 15 ); // these two lines are required to add support for v
2021-07-10 20:03:45 6KB Dart
1