Skip to content

Instantly share code, notes, and snippets.

@kormat
Last active July 31, 2019 12:14
Show Gist options
  • Save kormat/89d9a07b9d83f4ebebe14666b43bc326 to your computer and use it in GitHub Desktop.
Save kormat/89d9a07b9d83f4ebebe14666b43bc326 to your computer and use it in GitHub Desktop.
@0x866c06cc12d9b24d;
using Go = import "/go.capnp";
$Go.package("test");
$Go.import("zombiezen.com/go/capnproto2/example");
struct A {
a @0 :UInt8;
}
// Code generated by capnpc-go. DO NOT EDIT.
package test
import (
capnp "zombiezen.com/go/capnproto2"
text "zombiezen.com/go/capnproto2/encoding/text"
schemas "zombiezen.com/go/capnproto2/schemas"
)
type A struct{ capnp.Struct }
// A_TypeID is the unique identifier for the type A.
const A_TypeID = 0xee4ae1c432b977ab
func NewA(s *capnp.Segment) (A, error) {
st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 0})
return A{st}, err
}
func NewRootA(s *capnp.Segment) (A, error) {
st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 0})
return A{st}, err
}
func ReadRootA(msg *capnp.Message) (A, error) {
root, err := msg.RootPtr()
return A{root.Struct()}, err
}
func (s A) String() string {
str, _ := text.Marshal(0xee4ae1c432b977ab, s.Struct)
return str
}
func (s A) A() uint8 {
return s.Struct.Uint8(0)
}
func (s A) SetA(v uint8) {
s.Struct.SetUint8(0, v)
}
// A_List is a list of A.
type A_List struct{ capnp.List }
// NewA creates a new list of A.
func NewA_List(s *capnp.Segment, sz int32) (A_List, error) {
l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 8, PointerCount: 0}, sz)
return A_List{l}, err
}
func (s A_List) At(i int) A { return A{s.List.Struct(i)} }
func (s A_List) Set(i int, v A) error { return s.List.SetStruct(i, v.Struct) }
func (s A_List) String() string {
str, _ := text.MarshalList(0xee4ae1c432b977ab, s.List)
return str
}
// A_Promise is a wrapper for a A promised by a client call.
type A_Promise struct{ *capnp.Pipeline }
func (p A_Promise) Struct() (A, error) {
s, err := p.Pipeline.Struct()
return A{s}, err
}
const schema_866c06cc12d9b24d = "x\xda\x12Hq`2d\xcdgb`\x08\x94ae" +
"\xfb\xbf\xba|\xa7\xd1\x91\x87^\xef\x18\x029\x18\x19\xff" +
"\xfbn\xba)t\x86-\xa7\x8d\x81\x85\x9d\x81AX\x96" +
"1HX\x91\x11\xc2\xb2gp\xfe\x9f\xa8\x97\x9cX\x90" +
"W`\xc5\xc0\xe8\x18\xc0\xc8\x18\xc8\xc2\xcc\xc2\xc0\xc0\xc2" +
"\xc8\xc0 \xc8+\xc4\xc0\x10\xc8\xc1\xcc\x18(\xc2\xc4\xc8" +
"\x98\xc8\xc8\xc6\xc0\xc4\xc8\xc6\xc0\x08\x08\x00\x00\xff\xffq" +
"W\x14{"
func init() {
schemas.Register(schema_866c06cc12d9b24d,
0xee4ae1c432b977ab)
}
// Code generated by capnpc-go. DO NOT EDIT.
package test
import (
capnp "zombiezen.com/go/capnproto2"
text "zombiezen.com/go/capnproto2/encoding/text"
schemas "zombiezen.com/go/capnproto2/schemas"
)
type A struct{ capnp.Struct }
// A_TypeID is the unique identifier for the type A.
const A_TypeID = 0xee4ae1c432b977ab
func NewA(s *capnp.Segment) (A, error) {
st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 0})
return A{st}, err
}
func NewRootA(s *capnp.Segment) (A, error) {
st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 0})
return A{st}, err
}
func ReadRootA(msg *capnp.Message) (A, error) {
root, err := msg.RootPtr()
return A{root.Struct()}, err
}
func (s A) String() string {
str, _ := text.Marshal(0xee4ae1c432b977ab, s.Struct)
return str
}
func (s A) A() uint8 {
return s.Struct.Uint8(0)
}
func (s A) SetA(v uint8) {
s.Struct.SetUint8(0, v)
}
// A_List is a list of A.
type A_List struct{ capnp.List }
// NewA creates a new list of A.
func NewA_List(s *capnp.Segment, sz int32) (A_List, error) {
l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 8, PointerCount: 0}, sz)
return A_List{l}, err
}
func (s A_List) At(i int) A { return A{s.List.Struct(i)} }
func (s A_List) Set(i int, v A) error { return s.List.SetStruct(i, v.Struct) }
func (s A_List) String() string {
str, _ := text.MarshalList(0xee4ae1c432b977ab, s.List)
return str
}
// A_Promise is a wrapper for a A promised by a client call.
type A_Promise struct{ *capnp.Pipeline }
func (p A_Promise) Struct() (A, error) {
s, err := p.Pipeline.Struct()
return A{s}, err
}
const schema_866c06cc12d9b24d = "x\xda\x12\xf0s`2d\xdd\xcf\xc8\xc0\x10(\xc2\xca" +
"\xf6\x7fu\xf9N\xa3#\x0f\xbd\xde1\x04r02\xfe" +
"\xf7\xddtS\xe8\x0c[N\x1b\x03\x0b;\x03\x83\xe0\xd1" +
" \xc1\x93`\xda\x9eA\xf7\x7f\xa2^rbA^\x81" +
"\x15\x03\xa3c\x00#c \x0b3\x0b\x03\x03\x0b#\x03" +
"\x83 \xaf\x10\x03C \x073c\xa0\x08\x13#c\"" +
"#\x1b\x03\x13#\x1b\x03# \x00\x00\xff\xff\xc4\x08\x16" +
"\x85"
func init() {
schemas.Register(schema_866c06cc12d9b24d,
0xee4ae1c432b977ab)
}
@0xf66913fbaf13546c;
using Go = import "/go.capnp";
$Go.package("test");
$Go.import("zombiezen.com/go/capnproto2/example");
struct B {
b @0 :UInt8;
}
( nodes = [
( id = 16843653696247128979,
displayName = "b.capnp:B",
displayNamePrefixLength = 8,
scopeId = 17755744977579889772,
nestedNodes = [],
struct = (
dataWordCount = 1,
pointerCount = 0,
preferredListEncoding = inlineComposite,
isGroup = false,
discriminantCount = 0,
discriminantOffset = 0,
fields = [
( name = "b",
codeOrder = 0,
discriminantValue = 65535,
slot = (
offset = 0,
type = (uint8 = void),
defaultValue = (uint8 = 0),
hadExplicitDefault = false ),
ordinal = (explicit = 0) ) ] ),
isGeneric = false ),
( id = 17755744977579889772,
displayName = "b.capnp",
displayNamePrefixLength = 2,
scopeId = 0,
nestedNodes = [
( name = "B",
id = 16843653696247128979 ) ],
annotations = [
( id = 13738651845561756640,
value = (text = "test"),
brand = () ),
( id = 16226669573465588917,
value = (
text = "zombiezen.com/go/capnproto2/example" ),
brand = () ) ],
file = void,
isGeneric = false ),
( id = 17170784762084292523,
displayName = "a.capnp:A",
displayNamePrefixLength = 8,
scopeId = 9686124372126446157,
nestedNodes = [],
struct = (
dataWordCount = 1,
pointerCount = 0,
preferredListEncoding = inlineComposite,
isGroup = false,
discriminantCount = 0,
discriminantOffset = 0,
fields = [
( name = "a",
codeOrder = 0,
discriminantValue = 65535,
slot = (
offset = 0,
type = (uint8 = void),
defaultValue = (uint8 = 0),
hadExplicitDefault = false ),
ordinal = (explicit = 0) ) ] ),
isGeneric = false ),
( id = 9686124372126446157,
displayName = "a.capnp",
displayNamePrefixLength = 2,
scopeId = 0,
nestedNodes = [
( name = "A",
id = 17170784762084292523 ) ],
annotations = [
( id = 13738651845561756640,
value = (text = "test"),
brand = () ),
( id = 16226669573465588917,
value = (
text = "zombiezen.com/go/capnproto2/example" ),
brand = () ) ],
file = void,
isGeneric = false ),
( id = 16226669573465588917,
displayName = "go.capnp:import",
displayNamePrefixLength = 9,
scopeId = 15071890241442638984,
nestedNodes = [],
annotation = (
type = (text = void),
targetsFile = true,
targetsConst = false,
targetsEnum = false,
targetsEnumerant = false,
targetsStruct = false,
targetsField = false,
targetsUnion = false,
targetsGroup = false,
targetsInterface = false,
targetsMethod = false,
targetsParam = false,
targetsAnnotation = false ),
isGeneric = false ),
( id = 13738651845561756640,
displayName = "go.capnp:package",
displayNamePrefixLength = 9,
scopeId = 15071890241442638984,
nestedNodes = [],
annotation = (
type = (text = void),
targetsFile = true,
targetsConst = false,
targetsEnum = false,
targetsEnumerant = false,
targetsStruct = false,
targetsField = false,
targetsUnion = false,
targetsGroup = false,
targetsInterface = false,
targetsMethod = false,
targetsParam = false,
targetsAnnotation = false ),
isGeneric = false ),
( id = 15071890241442638984,
displayName = "go.capnp",
displayNamePrefixLength = 3,
scopeId = 0,
nestedNodes = [
( name = "package",
id = 13738651845561756640 ),
( name = "import",
id = 16226669573465588917 ),
( name = "doc",
id = 14234425680864449374 ),
( name = "tag",
id = 11922352133641007047 ),
( name = "notag",
id = 14444880713051463698 ),
( name = "customtype",
id = 18019013824969908371 ),
( name = "name",
id = 14031351744864161265 ) ],
annotations = [
( id = 13738651845561756640,
value = (text = "capnp"),
brand = () ),
( id = 16226669573465588917,
value = (
text = "zombiezen.com/go/capnproto2" ),
brand = () ) ],
file = void,
isGeneric = false ) ],
requestedFiles = [
( id = 9686124372126446157,
filename = "a.capnp",
imports = [
( id = 15071890241442638984,
name = "/go.capnp" ) ] ),
( id = 17755744977579889772,
filename = "b.capnp",
imports = [
( id = 15071890241442638984,
name = "/go.capnp" ) ] ) ] )
( nodes = [
( id = 17170784762084292523,
displayName = "a.capnp:A",
displayNamePrefixLength = 8,
scopeId = 9686124372126446157,
nestedNodes = [],
struct = (
dataWordCount = 1,
pointerCount = 0,
preferredListEncoding = inlineComposite,
isGroup = false,
discriminantCount = 0,
discriminantOffset = 0,
fields = [
( name = "a",
codeOrder = 0,
discriminantValue = 65535,
slot = (
offset = 0,
type = (uint8 = void),
defaultValue = (uint8 = 0),
hadExplicitDefault = false ),
ordinal = (explicit = 0) ) ] ),
isGeneric = false ),
( id = 9686124372126446157,
displayName = "a.capnp",
displayNamePrefixLength = 2,
scopeId = 0,
nestedNodes = [
( name = "A",
id = 17170784762084292523 ) ],
annotations = [
( id = 13738651845561756640,
value = (text = "test"),
brand = () ),
( id = 16226669573465588917,
value = (
text = "zombiezen.com/go/capnproto2/example" ),
brand = () ) ],
file = void,
isGeneric = false ),
( id = 16226669573465588917,
displayName = "go.capnp:import",
displayNamePrefixLength = 9,
scopeId = 15071890241442638984,
nestedNodes = [],
annotation = (
type = (text = void),
targetsFile = true,
targetsConst = false,
targetsEnum = false,
targetsEnumerant = false,
targetsStruct = false,
targetsField = false,
targetsUnion = false,
targetsGroup = false,
targetsInterface = false,
targetsMethod = false,
targetsParam = false,
targetsAnnotation = false ),
isGeneric = false ),
( id = 13738651845561756640,
displayName = "go.capnp:package",
displayNamePrefixLength = 9,
scopeId = 15071890241442638984,
nestedNodes = [],
annotation = (
type = (text = void),
targetsFile = true,
targetsConst = false,
targetsEnum = false,
targetsEnumerant = false,
targetsStruct = false,
targetsField = false,
targetsUnion = false,
targetsGroup = false,
targetsInterface = false,
targetsMethod = false,
targetsParam = false,
targetsAnnotation = false ),
isGeneric = false ),
( id = 15071890241442638984,
displayName = "go.capnp",
displayNamePrefixLength = 3,
scopeId = 0,
nestedNodes = [
( name = "package",
id = 13738651845561756640 ),
( name = "import",
id = 16226669573465588917 ),
( name = "doc",
id = 14234425680864449374 ),
( name = "tag",
id = 11922352133641007047 ),
( name = "notag",
id = 14444880713051463698 ),
( name = "customtype",
id = 18019013824969908371 ),
( name = "name",
id = 14031351744864161265 ) ],
annotations = [
( id = 13738651845561756640,
value = (text = "capnp"),
brand = () ),
( id = 16226669573465588917,
value = (
text = "zombiezen.com/go/capnproto2" ),
brand = () ) ],
file = void,
isGeneric = false ) ],
requestedFiles = [
( id = 9686124372126446157,
filename = "a.capnp",
imports = [
( id = 15071890241442638984,
name = "/go.capnp" ) ] ) ] )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment