// Code generated by capnpc-go. DO NOT EDIT.

package bytestream

import (
	capnp "capnproto.org/go/capnp/v3"
	text "capnproto.org/go/capnp/v3/encoding/text"
	fc "capnproto.org/go/capnp/v3/flowcontrol"
	schemas "capnproto.org/go/capnp/v3/schemas"
	server "capnproto.org/go/capnp/v3/server"
	stream "capnproto.org/go/capnp/v3/std/capnp/stream"
	context "context"
)

type ByteStream capnp.Client

// ByteStream_TypeID is the unique identifier for the type ByteStream.
const ByteStream_TypeID = 0xd2e7d8a0dc0a9766

func (c ByteStream) Write(ctx context.Context, params func(ByteStream_write_Params) error) error {
	s := capnp.Send{
		Method: capnp.Method{
			InterfaceID:   0xd2e7d8a0dc0a9766,
			MethodID:      0,
			InterfaceName: "byte-stream.capnp:ByteStream",
			MethodName:    "write",
		},
	}
	if params != nil {
		s.ArgsSize = capnp.ObjectSize{DataSize: 0, PointerCount: 1}
		s.PlaceArgs = func(s capnp.Struct) error { return params(ByteStream_write_Params(s)) }
	}

	return capnp.Client(c).SendStreamCall(ctx, s)

}

func (c ByteStream) End(ctx context.Context, params func(ByteStream_end_Params) error) (ByteStream_end_Results_Future, capnp.ReleaseFunc) {

	s := capnp.Send{
		Method: capnp.Method{
			InterfaceID:   0xd2e7d8a0dc0a9766,
			MethodID:      1,
			InterfaceName: "byte-stream.capnp:ByteStream",
			MethodName:    "end",
		},
	}
	if params != nil {
		s.ArgsSize = capnp.ObjectSize{DataSize: 0, PointerCount: 0}
		s.PlaceArgs = func(s capnp.Struct) error { return params(ByteStream_end_Params(s)) }
	}

	ans, release := capnp.Client(c).SendCall(ctx, s)
	return ByteStream_end_Results_Future{Future: ans.Future()}, release

}

func (c ByteStream) GetSubstream(ctx context.Context, params func(ByteStream_getSubstream_Params) error) (ByteStream_getSubstream_Results_Future, capnp.ReleaseFunc) {

	s := capnp.Send{
		Method: capnp.Method{
			InterfaceID:   0xd2e7d8a0dc0a9766,
			MethodID:      2,
			InterfaceName: "byte-stream.capnp:ByteStream",
			MethodName:    "getSubstream",
		},
	}
	if params != nil {
		s.ArgsSize = capnp.ObjectSize{DataSize: 8, PointerCount: 1}
		s.PlaceArgs = func(s capnp.Struct) error { return params(ByteStream_getSubstream_Params(s)) }
	}

	ans, release := capnp.Client(c).SendCall(ctx, s)
	return ByteStream_getSubstream_Results_Future{Future: ans.Future()}, release

}

func (c ByteStream) StartTls(ctx context.Context, params func(ByteStream_startTls_Params) error) error {
	s := capnp.Send{
		Method: capnp.Method{
			InterfaceID:   0xd2e7d8a0dc0a9766,
			MethodID:      3,
			InterfaceName: "byte-stream.capnp:ByteStream",
			MethodName:    "startTls",
		},
	}
	if params != nil {
		s.ArgsSize = capnp.ObjectSize{DataSize: 0, PointerCount: 1}
		s.PlaceArgs = func(s capnp.Struct) error { return params(ByteStream_startTls_Params(s)) }
	}

	return capnp.Client(c).SendStreamCall(ctx, s)

}

func (c ByteStream) WaitStreaming() error {
	return capnp.Client(c).WaitStreaming()
}

// String returns a string that identifies this capability for debugging
// purposes.  Its format should not be depended on: in particular, it
// should not be used to compare clients.  Use IsSame to compare clients
// for equality.
func (c ByteStream) String() string {
	return "ByteStream(" + capnp.Client(c).String() + ")"
}

// AddRef creates a new Client that refers to the same capability as c.
// If c is nil or has resolved to null, then AddRef returns nil.
func (c ByteStream) AddRef() ByteStream {
	return ByteStream(capnp.Client(c).AddRef())
}

// Release releases a capability reference.  If this is the last
// reference to the capability, then the underlying resources associated
// with the capability will be released.
//
// Release will panic if c has already been released, but not if c is
// nil or resolved to null.
func (c ByteStream) Release() {
	capnp.Client(c).Release()
}

// Resolve blocks until the capability is fully resolved or the Context
// expires.
func (c ByteStream) Resolve(ctx context.Context) error {
	return capnp.Client(c).Resolve(ctx)
}

func (c ByteStream) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr {
	return capnp.Client(c).EncodeAsPtr(seg)
}

func (ByteStream) DecodeFromPtr(p capnp.Ptr) ByteStream {
	return ByteStream(capnp.Client{}.DecodeFromPtr(p))
}

// IsValid reports whether c is a valid reference to a capability.
// A reference is invalid if it is nil, has resolved to null, or has
// been released.
func (c ByteStream) IsValid() bool {
	return capnp.Client(c).IsValid()
}

// IsSame reports whether c and other refer to a capability created by the
// same call to NewClient.  This can return false negatives if c or other
// are not fully resolved: use Resolve if this is an issue.  If either
// c or other are released, then IsSame panics.
func (c ByteStream) IsSame(other ByteStream) bool {
	return capnp.Client(c).IsSame(capnp.Client(other))
}

// Update the flowcontrol.FlowLimiter used to manage flow control for
// this client. This affects all future calls, but not calls already
// waiting to send. Passing nil sets the value to flowcontrol.NopLimiter,
// which is also the default.
func (c ByteStream) SetFlowLimiter(lim fc.FlowLimiter) {
	capnp.Client(c).SetFlowLimiter(lim)
}

// Get the current flowcontrol.FlowLimiter used to manage flow control
// for this client.
func (c ByteStream) GetFlowLimiter() fc.FlowLimiter {
	return capnp.Client(c).GetFlowLimiter()
}

// A ByteStream_Server is a ByteStream with a local implementation.
type ByteStream_Server interface {
	Write(context.Context, ByteStream_write) error

	End(context.Context, ByteStream_end) error

	GetSubstream(context.Context, ByteStream_getSubstream) error

	StartTls(context.Context, ByteStream_startTls) error
}

// ByteStream_NewServer creates a new Server from an implementation of ByteStream_Server.
func ByteStream_NewServer(s ByteStream_Server) *server.Server {
	c, _ := s.(server.Shutdowner)
	return server.New(ByteStream_Methods(nil, s), s, c)
}

// ByteStream_ServerToClient creates a new Client from an implementation of ByteStream_Server.
// The caller is responsible for calling Release on the returned Client.
func ByteStream_ServerToClient(s ByteStream_Server) ByteStream {
	return ByteStream(capnp.NewClient(ByteStream_NewServer(s)))
}

// ByteStream_Methods appends Methods to a slice that invoke the methods on s.
// This can be used to create a more complicated Server.
func ByteStream_Methods(methods []server.Method, s ByteStream_Server) []server.Method {
	if cap(methods) == 0 {
		methods = make([]server.Method, 0, 4)
	}

	methods = append(methods, server.Method{
		Method: capnp.Method{
			InterfaceID:   0xd2e7d8a0dc0a9766,
			MethodID:      0,
			InterfaceName: "byte-stream.capnp:ByteStream",
			MethodName:    "write",
		},
		Impl: func(ctx context.Context, call *server.Call) error {
			return s.Write(ctx, ByteStream_write{call})
		},
	})

	methods = append(methods, server.Method{
		Method: capnp.Method{
			InterfaceID:   0xd2e7d8a0dc0a9766,
			MethodID:      1,
			InterfaceName: "byte-stream.capnp:ByteStream",
			MethodName:    "end",
		},
		Impl: func(ctx context.Context, call *server.Call) error {
			return s.End(ctx, ByteStream_end{call})
		},
	})

	methods = append(methods, server.Method{
		Method: capnp.Method{
			InterfaceID:   0xd2e7d8a0dc0a9766,
			MethodID:      2,
			InterfaceName: "byte-stream.capnp:ByteStream",
			MethodName:    "getSubstream",
		},
		Impl: func(ctx context.Context, call *server.Call) error {
			return s.GetSubstream(ctx, ByteStream_getSubstream{call})
		},
	})

	methods = append(methods, server.Method{
		Method: capnp.Method{
			InterfaceID:   0xd2e7d8a0dc0a9766,
			MethodID:      3,
			InterfaceName: "byte-stream.capnp:ByteStream",
			MethodName:    "startTls",
		},
		Impl: func(ctx context.Context, call *server.Call) error {
			return s.StartTls(ctx, ByteStream_startTls{call})
		},
	})

	return methods
}

// ByteStream_write holds the state for a server call to ByteStream.write.
// See server.Call for documentation.
type ByteStream_write struct {
	*server.Call
}

// Args returns the call's arguments.
func (c ByteStream_write) Args() ByteStream_write_Params {
	return ByteStream_write_Params(c.Call.Args())
}

// AllocResults allocates the results struct.
func (c ByteStream_write) AllocResults() (stream.StreamResult, error) {
	r, err := c.Call.AllocResults(capnp.ObjectSize{DataSize: 0, PointerCount: 0})
	return stream.StreamResult(r), err
}

// ByteStream_end holds the state for a server call to ByteStream.end.
// See server.Call for documentation.
type ByteStream_end struct {
	*server.Call
}

// Args returns the call's arguments.
func (c ByteStream_end) Args() ByteStream_end_Params {
	return ByteStream_end_Params(c.Call.Args())
}

// AllocResults allocates the results struct.
func (c ByteStream_end) AllocResults() (ByteStream_end_Results, error) {
	r, err := c.Call.AllocResults(capnp.ObjectSize{DataSize: 0, PointerCount: 0})
	return ByteStream_end_Results(r), err
}

// ByteStream_getSubstream holds the state for a server call to ByteStream.getSubstream.
// See server.Call for documentation.
type ByteStream_getSubstream struct {
	*server.Call
}

// Args returns the call's arguments.
func (c ByteStream_getSubstream) Args() ByteStream_getSubstream_Params {
	return ByteStream_getSubstream_Params(c.Call.Args())
}

// AllocResults allocates the results struct.
func (c ByteStream_getSubstream) AllocResults() (ByteStream_getSubstream_Results, error) {
	r, err := c.Call.AllocResults(capnp.ObjectSize{DataSize: 0, PointerCount: 1})
	return ByteStream_getSubstream_Results(r), err
}

// ByteStream_startTls holds the state for a server call to ByteStream.startTls.
// See server.Call for documentation.
type ByteStream_startTls struct {
	*server.Call
}

// Args returns the call's arguments.
func (c ByteStream_startTls) Args() ByteStream_startTls_Params {
	return ByteStream_startTls_Params(c.Call.Args())
}

// AllocResults allocates the results struct.
func (c ByteStream_startTls) AllocResults() (stream.StreamResult, error) {
	r, err := c.Call.AllocResults(capnp.ObjectSize{DataSize: 0, PointerCount: 0})
	return stream.StreamResult(r), err
}

// ByteStream_List is a list of ByteStream.
type ByteStream_List = capnp.CapList[ByteStream]

// NewByteStream creates a new list of ByteStream.
func NewByteStream_List(s *capnp.Segment, sz int32) (ByteStream_List, error) {
	l, err := capnp.NewPointerList(s, sz)
	return capnp.CapList[ByteStream](l), err
}

type ByteStream_SubstreamCallback capnp.Client

// ByteStream_SubstreamCallback_TypeID is the unique identifier for the type ByteStream_SubstreamCallback.
const ByteStream_SubstreamCallback_TypeID = 0xb23c0a13cf65c36e

func (c ByteStream_SubstreamCallback) Ended(ctx context.Context, params func(ByteStream_SubstreamCallback_ended_Params) error) (ByteStream_SubstreamCallback_ended_Results_Future, capnp.ReleaseFunc) {

	s := capnp.Send{
		Method: capnp.Method{
			InterfaceID:   0xb23c0a13cf65c36e,
			MethodID:      0,
			InterfaceName: "byte-stream.capnp:ByteStream.SubstreamCallback",
			MethodName:    "ended",
		},
	}
	if params != nil {
		s.ArgsSize = capnp.ObjectSize{DataSize: 8, PointerCount: 0}
		s.PlaceArgs = func(s capnp.Struct) error { return params(ByteStream_SubstreamCallback_ended_Params(s)) }
	}

	ans, release := capnp.Client(c).SendCall(ctx, s)
	return ByteStream_SubstreamCallback_ended_Results_Future{Future: ans.Future()}, release

}

func (c ByteStream_SubstreamCallback) ReachedLimit(ctx context.Context, params func(ByteStream_SubstreamCallback_reachedLimit_Params) error) (ByteStream_SubstreamCallback_reachedLimit_Results_Future, capnp.ReleaseFunc) {

	s := capnp.Send{
		Method: capnp.Method{
			InterfaceID:   0xb23c0a13cf65c36e,
			MethodID:      1,
			InterfaceName: "byte-stream.capnp:ByteStream.SubstreamCallback",
			MethodName:    "reachedLimit",
		},
	}
	if params != nil {
		s.ArgsSize = capnp.ObjectSize{DataSize: 0, PointerCount: 0}
		s.PlaceArgs = func(s capnp.Struct) error { return params(ByteStream_SubstreamCallback_reachedLimit_Params(s)) }
	}

	ans, release := capnp.Client(c).SendCall(ctx, s)
	return ByteStream_SubstreamCallback_reachedLimit_Results_Future{Future: ans.Future()}, release

}

func (c ByteStream_SubstreamCallback) WaitStreaming() error {
	return capnp.Client(c).WaitStreaming()
}

// String returns a string that identifies this capability for debugging
// purposes.  Its format should not be depended on: in particular, it
// should not be used to compare clients.  Use IsSame to compare clients
// for equality.
func (c ByteStream_SubstreamCallback) String() string {
	return "ByteStream_SubstreamCallback(" + capnp.Client(c).String() + ")"
}

// AddRef creates a new Client that refers to the same capability as c.
// If c is nil or has resolved to null, then AddRef returns nil.
func (c ByteStream_SubstreamCallback) AddRef() ByteStream_SubstreamCallback {
	return ByteStream_SubstreamCallback(capnp.Client(c).AddRef())
}

// Release releases a capability reference.  If this is the last
// reference to the capability, then the underlying resources associated
// with the capability will be released.
//
// Release will panic if c has already been released, but not if c is
// nil or resolved to null.
func (c ByteStream_SubstreamCallback) Release() {
	capnp.Client(c).Release()
}

// Resolve blocks until the capability is fully resolved or the Context
// expires.
func (c ByteStream_SubstreamCallback) Resolve(ctx context.Context) error {
	return capnp.Client(c).Resolve(ctx)
}

func (c ByteStream_SubstreamCallback) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr {
	return capnp.Client(c).EncodeAsPtr(seg)
}

func (ByteStream_SubstreamCallback) DecodeFromPtr(p capnp.Ptr) ByteStream_SubstreamCallback {
	return ByteStream_SubstreamCallback(capnp.Client{}.DecodeFromPtr(p))
}

// IsValid reports whether c is a valid reference to a capability.
// A reference is invalid if it is nil, has resolved to null, or has
// been released.
func (c ByteStream_SubstreamCallback) IsValid() bool {
	return capnp.Client(c).IsValid()
}

// IsSame reports whether c and other refer to a capability created by the
// same call to NewClient.  This can return false negatives if c or other
// are not fully resolved: use Resolve if this is an issue.  If either
// c or other are released, then IsSame panics.
func (c ByteStream_SubstreamCallback) IsSame(other ByteStream_SubstreamCallback) bool {
	return capnp.Client(c).IsSame(capnp.Client(other))
}

// Update the flowcontrol.FlowLimiter used to manage flow control for
// this client. This affects all future calls, but not calls already
// waiting to send. Passing nil sets the value to flowcontrol.NopLimiter,
// which is also the default.
func (c ByteStream_SubstreamCallback) SetFlowLimiter(lim fc.FlowLimiter) {
	capnp.Client(c).SetFlowLimiter(lim)
}

// Get the current flowcontrol.FlowLimiter used to manage flow control
// for this client.
func (c ByteStream_SubstreamCallback) GetFlowLimiter() fc.FlowLimiter {
	return capnp.Client(c).GetFlowLimiter()
}

// A ByteStream_SubstreamCallback_Server is a ByteStream_SubstreamCallback with a local implementation.
type ByteStream_SubstreamCallback_Server interface {
	Ended(context.Context, ByteStream_SubstreamCallback_ended) error

	ReachedLimit(context.Context, ByteStream_SubstreamCallback_reachedLimit) error
}

// ByteStream_SubstreamCallback_NewServer creates a new Server from an implementation of ByteStream_SubstreamCallback_Server.
func ByteStream_SubstreamCallback_NewServer(s ByteStream_SubstreamCallback_Server) *server.Server {
	c, _ := s.(server.Shutdowner)
	return server.New(ByteStream_SubstreamCallback_Methods(nil, s), s, c)
}

// ByteStream_SubstreamCallback_ServerToClient creates a new Client from an implementation of ByteStream_SubstreamCallback_Server.
// The caller is responsible for calling Release on the returned Client.
func ByteStream_SubstreamCallback_ServerToClient(s ByteStream_SubstreamCallback_Server) ByteStream_SubstreamCallback {
	return ByteStream_SubstreamCallback(capnp.NewClient(ByteStream_SubstreamCallback_NewServer(s)))
}

// ByteStream_SubstreamCallback_Methods appends Methods to a slice that invoke the methods on s.
// This can be used to create a more complicated Server.
func ByteStream_SubstreamCallback_Methods(methods []server.Method, s ByteStream_SubstreamCallback_Server) []server.Method {
	if cap(methods) == 0 {
		methods = make([]server.Method, 0, 2)
	}

	methods = append(methods, server.Method{
		Method: capnp.Method{
			InterfaceID:   0xb23c0a13cf65c36e,
			MethodID:      0,
			InterfaceName: "byte-stream.capnp:ByteStream.SubstreamCallback",
			MethodName:    "ended",
		},
		Impl: func(ctx context.Context, call *server.Call) error {
			return s.Ended(ctx, ByteStream_SubstreamCallback_ended{call})
		},
	})

	methods = append(methods, server.Method{
		Method: capnp.Method{
			InterfaceID:   0xb23c0a13cf65c36e,
			MethodID:      1,
			InterfaceName: "byte-stream.capnp:ByteStream.SubstreamCallback",
			MethodName:    "reachedLimit",
		},
		Impl: func(ctx context.Context, call *server.Call) error {
			return s.ReachedLimit(ctx, ByteStream_SubstreamCallback_reachedLimit{call})
		},
	})

	return methods
}

// ByteStream_SubstreamCallback_ended holds the state for a server call to ByteStream_SubstreamCallback.ended.
// See server.Call for documentation.
type ByteStream_SubstreamCallback_ended struct {
	*server.Call
}

// Args returns the call's arguments.
func (c ByteStream_SubstreamCallback_ended) Args() ByteStream_SubstreamCallback_ended_Params {
	return ByteStream_SubstreamCallback_ended_Params(c.Call.Args())
}

// AllocResults allocates the results struct.
func (c ByteStream_SubstreamCallback_ended) AllocResults() (ByteStream_SubstreamCallback_ended_Results, error) {
	r, err := c.Call.AllocResults(capnp.ObjectSize{DataSize: 0, PointerCount: 0})
	return ByteStream_SubstreamCallback_ended_Results(r), err
}

// ByteStream_SubstreamCallback_reachedLimit holds the state for a server call to ByteStream_SubstreamCallback.reachedLimit.
// See server.Call for documentation.
type ByteStream_SubstreamCallback_reachedLimit struct {
	*server.Call
}

// Args returns the call's arguments.
func (c ByteStream_SubstreamCallback_reachedLimit) Args() ByteStream_SubstreamCallback_reachedLimit_Params {
	return ByteStream_SubstreamCallback_reachedLimit_Params(c.Call.Args())
}

// AllocResults allocates the results struct.
func (c ByteStream_SubstreamCallback_reachedLimit) AllocResults() (ByteStream_SubstreamCallback_reachedLimit_Results, error) {
	r, err := c.Call.AllocResults(capnp.ObjectSize{DataSize: 0, PointerCount: 1})
	return ByteStream_SubstreamCallback_reachedLimit_Results(r), err
}

// ByteStream_SubstreamCallback_List is a list of ByteStream_SubstreamCallback.
type ByteStream_SubstreamCallback_List = capnp.CapList[ByteStream_SubstreamCallback]

// NewByteStream_SubstreamCallback creates a new list of ByteStream_SubstreamCallback.
func NewByteStream_SubstreamCallback_List(s *capnp.Segment, sz int32) (ByteStream_SubstreamCallback_List, error) {
	l, err := capnp.NewPointerList(s, sz)
	return capnp.CapList[ByteStream_SubstreamCallback](l), err
}

type ByteStream_SubstreamCallback_ended_Params capnp.Struct

// ByteStream_SubstreamCallback_ended_Params_TypeID is the unique identifier for the type ByteStream_SubstreamCallback_ended_Params.
const ByteStream_SubstreamCallback_ended_Params_TypeID = 0xccb18eca8acafbe7

func NewByteStream_SubstreamCallback_ended_Params(s *capnp.Segment) (ByteStream_SubstreamCallback_ended_Params, error) {
	st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 0})
	return ByteStream_SubstreamCallback_ended_Params(st), err
}

func NewRootByteStream_SubstreamCallback_ended_Params(s *capnp.Segment) (ByteStream_SubstreamCallback_ended_Params, error) {
	st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 0})
	return ByteStream_SubstreamCallback_ended_Params(st), err
}

func ReadRootByteStream_SubstreamCallback_ended_Params(msg *capnp.Message) (ByteStream_SubstreamCallback_ended_Params, error) {
	root, err := msg.Root()
	return ByteStream_SubstreamCallback_ended_Params(root.Struct()), err
}

func (s ByteStream_SubstreamCallback_ended_Params) String() string {
	str, _ := text.Marshal(0xccb18eca8acafbe7, capnp.Struct(s))
	return str
}

func (s ByteStream_SubstreamCallback_ended_Params) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr {
	return capnp.Struct(s).EncodeAsPtr(seg)
}

func (ByteStream_SubstreamCallback_ended_Params) DecodeFromPtr(p capnp.Ptr) ByteStream_SubstreamCallback_ended_Params {
	return ByteStream_SubstreamCallback_ended_Params(capnp.Struct{}.DecodeFromPtr(p))
}

func (s ByteStream_SubstreamCallback_ended_Params) ToPtr() capnp.Ptr {
	return capnp.Struct(s).ToPtr()
}
func (s ByteStream_SubstreamCallback_ended_Params) IsValid() bool {
	return capnp.Struct(s).IsValid()
}

func (s ByteStream_SubstreamCallback_ended_Params) Message() *capnp.Message {
	return capnp.Struct(s).Message()
}

func (s ByteStream_SubstreamCallback_ended_Params) Segment() *capnp.Segment {
	return capnp.Struct(s).Segment()
}
func (s ByteStream_SubstreamCallback_ended_Params) ByteCount() uint64 {
	return capnp.Struct(s).Uint64(0)
}

func (s ByteStream_SubstreamCallback_ended_Params) SetByteCount(v uint64) {
	capnp.Struct(s).SetUint64(0, v)
}

// ByteStream_SubstreamCallback_ended_Params_List is a list of ByteStream_SubstreamCallback_ended_Params.
type ByteStream_SubstreamCallback_ended_Params_List = capnp.StructList[ByteStream_SubstreamCallback_ended_Params]

// NewByteStream_SubstreamCallback_ended_Params creates a new list of ByteStream_SubstreamCallback_ended_Params.
func NewByteStream_SubstreamCallback_ended_Params_List(s *capnp.Segment, sz int32) (ByteStream_SubstreamCallback_ended_Params_List, error) {
	l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 8, PointerCount: 0}, sz)
	return capnp.StructList[ByteStream_SubstreamCallback_ended_Params](l), err
}

// ByteStream_SubstreamCallback_ended_Params_Future is a wrapper for a ByteStream_SubstreamCallback_ended_Params promised by a client call.
type ByteStream_SubstreamCallback_ended_Params_Future struct{ *capnp.Future }

func (f ByteStream_SubstreamCallback_ended_Params_Future) Struct() (ByteStream_SubstreamCallback_ended_Params, error) {
	p, err := f.Future.Ptr()
	return ByteStream_SubstreamCallback_ended_Params(p.Struct()), err
}

type ByteStream_SubstreamCallback_ended_Results capnp.Struct

// ByteStream_SubstreamCallback_ended_Results_TypeID is the unique identifier for the type ByteStream_SubstreamCallback_ended_Results.
const ByteStream_SubstreamCallback_ended_Results_TypeID = 0xba8feb56b5b6922d

func NewByteStream_SubstreamCallback_ended_Results(s *capnp.Segment) (ByteStream_SubstreamCallback_ended_Results, error) {
	st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0})
	return ByteStream_SubstreamCallback_ended_Results(st), err
}

func NewRootByteStream_SubstreamCallback_ended_Results(s *capnp.Segment) (ByteStream_SubstreamCallback_ended_Results, error) {
	st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0})
	return ByteStream_SubstreamCallback_ended_Results(st), err
}

func ReadRootByteStream_SubstreamCallback_ended_Results(msg *capnp.Message) (ByteStream_SubstreamCallback_ended_Results, error) {
	root, err := msg.Root()
	return ByteStream_SubstreamCallback_ended_Results(root.Struct()), err
}

func (s ByteStream_SubstreamCallback_ended_Results) String() string {
	str, _ := text.Marshal(0xba8feb56b5b6922d, capnp.Struct(s))
	return str
}

func (s ByteStream_SubstreamCallback_ended_Results) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr {
	return capnp.Struct(s).EncodeAsPtr(seg)
}

func (ByteStream_SubstreamCallback_ended_Results) DecodeFromPtr(p capnp.Ptr) ByteStream_SubstreamCallback_ended_Results {
	return ByteStream_SubstreamCallback_ended_Results(capnp.Struct{}.DecodeFromPtr(p))
}

func (s ByteStream_SubstreamCallback_ended_Results) ToPtr() capnp.Ptr {
	return capnp.Struct(s).ToPtr()
}
func (s ByteStream_SubstreamCallback_ended_Results) IsValid() bool {
	return capnp.Struct(s).IsValid()
}

func (s ByteStream_SubstreamCallback_ended_Results) Message() *capnp.Message {
	return capnp.Struct(s).Message()
}

func (s ByteStream_SubstreamCallback_ended_Results) Segment() *capnp.Segment {
	return capnp.Struct(s).Segment()
}

// ByteStream_SubstreamCallback_ended_Results_List is a list of ByteStream_SubstreamCallback_ended_Results.
type ByteStream_SubstreamCallback_ended_Results_List = capnp.StructList[ByteStream_SubstreamCallback_ended_Results]

// NewByteStream_SubstreamCallback_ended_Results creates a new list of ByteStream_SubstreamCallback_ended_Results.
func NewByteStream_SubstreamCallback_ended_Results_List(s *capnp.Segment, sz int32) (ByteStream_SubstreamCallback_ended_Results_List, error) {
	l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}, sz)
	return capnp.StructList[ByteStream_SubstreamCallback_ended_Results](l), err
}

// ByteStream_SubstreamCallback_ended_Results_Future is a wrapper for a ByteStream_SubstreamCallback_ended_Results promised by a client call.
type ByteStream_SubstreamCallback_ended_Results_Future struct{ *capnp.Future }

func (f ByteStream_SubstreamCallback_ended_Results_Future) Struct() (ByteStream_SubstreamCallback_ended_Results, error) {
	p, err := f.Future.Ptr()
	return ByteStream_SubstreamCallback_ended_Results(p.Struct()), err
}

type ByteStream_SubstreamCallback_reachedLimit_Params capnp.Struct

// ByteStream_SubstreamCallback_reachedLimit_Params_TypeID is the unique identifier for the type ByteStream_SubstreamCallback_reachedLimit_Params.
const ByteStream_SubstreamCallback_reachedLimit_Params_TypeID = 0xd80bf35671585f44

func NewByteStream_SubstreamCallback_reachedLimit_Params(s *capnp.Segment) (ByteStream_SubstreamCallback_reachedLimit_Params, error) {
	st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0})
	return ByteStream_SubstreamCallback_reachedLimit_Params(st), err
}

func NewRootByteStream_SubstreamCallback_reachedLimit_Params(s *capnp.Segment) (ByteStream_SubstreamCallback_reachedLimit_Params, error) {
	st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0})
	return ByteStream_SubstreamCallback_reachedLimit_Params(st), err
}

func ReadRootByteStream_SubstreamCallback_reachedLimit_Params(msg *capnp.Message) (ByteStream_SubstreamCallback_reachedLimit_Params, error) {
	root, err := msg.Root()
	return ByteStream_SubstreamCallback_reachedLimit_Params(root.Struct()), err
}

func (s ByteStream_SubstreamCallback_reachedLimit_Params) String() string {
	str, _ := text.Marshal(0xd80bf35671585f44, capnp.Struct(s))
	return str
}

func (s ByteStream_SubstreamCallback_reachedLimit_Params) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr {
	return capnp.Struct(s).EncodeAsPtr(seg)
}

func (ByteStream_SubstreamCallback_reachedLimit_Params) DecodeFromPtr(p capnp.Ptr) ByteStream_SubstreamCallback_reachedLimit_Params {
	return ByteStream_SubstreamCallback_reachedLimit_Params(capnp.Struct{}.DecodeFromPtr(p))
}

func (s ByteStream_SubstreamCallback_reachedLimit_Params) ToPtr() capnp.Ptr {
	return capnp.Struct(s).ToPtr()
}
func (s ByteStream_SubstreamCallback_reachedLimit_Params) IsValid() bool {
	return capnp.Struct(s).IsValid()
}

func (s ByteStream_SubstreamCallback_reachedLimit_Params) Message() *capnp.Message {
	return capnp.Struct(s).Message()
}

func (s ByteStream_SubstreamCallback_reachedLimit_Params) Segment() *capnp.Segment {
	return capnp.Struct(s).Segment()
}

// ByteStream_SubstreamCallback_reachedLimit_Params_List is a list of ByteStream_SubstreamCallback_reachedLimit_Params.
type ByteStream_SubstreamCallback_reachedLimit_Params_List = capnp.StructList[ByteStream_SubstreamCallback_reachedLimit_Params]

// NewByteStream_SubstreamCallback_reachedLimit_Params creates a new list of ByteStream_SubstreamCallback_reachedLimit_Params.
func NewByteStream_SubstreamCallback_reachedLimit_Params_List(s *capnp.Segment, sz int32) (ByteStream_SubstreamCallback_reachedLimit_Params_List, error) {
	l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}, sz)
	return capnp.StructList[ByteStream_SubstreamCallback_reachedLimit_Params](l), err
}

// ByteStream_SubstreamCallback_reachedLimit_Params_Future is a wrapper for a ByteStream_SubstreamCallback_reachedLimit_Params promised by a client call.
type ByteStream_SubstreamCallback_reachedLimit_Params_Future struct{ *capnp.Future }

func (f ByteStream_SubstreamCallback_reachedLimit_Params_Future) Struct() (ByteStream_SubstreamCallback_reachedLimit_Params, error) {
	p, err := f.Future.Ptr()
	return ByteStream_SubstreamCallback_reachedLimit_Params(p.Struct()), err
}

type ByteStream_SubstreamCallback_reachedLimit_Results capnp.Struct

// ByteStream_SubstreamCallback_reachedLimit_Results_TypeID is the unique identifier for the type ByteStream_SubstreamCallback_reachedLimit_Results.
const ByteStream_SubstreamCallback_reachedLimit_Results_TypeID = 0xddd06638ed144353

func NewByteStream_SubstreamCallback_reachedLimit_Results(s *capnp.Segment) (ByteStream_SubstreamCallback_reachedLimit_Results, error) {
	st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1})
	return ByteStream_SubstreamCallback_reachedLimit_Results(st), err
}

func NewRootByteStream_SubstreamCallback_reachedLimit_Results(s *capnp.Segment) (ByteStream_SubstreamCallback_reachedLimit_Results, error) {
	st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1})
	return ByteStream_SubstreamCallback_reachedLimit_Results(st), err
}

func ReadRootByteStream_SubstreamCallback_reachedLimit_Results(msg *capnp.Message) (ByteStream_SubstreamCallback_reachedLimit_Results, error) {
	root, err := msg.Root()
	return ByteStream_SubstreamCallback_reachedLimit_Results(root.Struct()), err
}

func (s ByteStream_SubstreamCallback_reachedLimit_Results) String() string {
	str, _ := text.Marshal(0xddd06638ed144353, capnp.Struct(s))
	return str
}

func (s ByteStream_SubstreamCallback_reachedLimit_Results) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr {
	return capnp.Struct(s).EncodeAsPtr(seg)
}

func (ByteStream_SubstreamCallback_reachedLimit_Results) DecodeFromPtr(p capnp.Ptr) ByteStream_SubstreamCallback_reachedLimit_Results {
	return ByteStream_SubstreamCallback_reachedLimit_Results(capnp.Struct{}.DecodeFromPtr(p))
}

func (s ByteStream_SubstreamCallback_reachedLimit_Results) ToPtr() capnp.Ptr {
	return capnp.Struct(s).ToPtr()
}
func (s ByteStream_SubstreamCallback_reachedLimit_Results) IsValid() bool {
	return capnp.Struct(s).IsValid()
}

func (s ByteStream_SubstreamCallback_reachedLimit_Results) Message() *capnp.Message {
	return capnp.Struct(s).Message()
}

func (s ByteStream_SubstreamCallback_reachedLimit_Results) Segment() *capnp.Segment {
	return capnp.Struct(s).Segment()
}
func (s ByteStream_SubstreamCallback_reachedLimit_Results) Next() ByteStream {
	p, _ := capnp.Struct(s).Ptr(0)
	return ByteStream(p.Interface().Client())
}

func (s ByteStream_SubstreamCallback_reachedLimit_Results) HasNext() bool {
	return capnp.Struct(s).HasPtr(0)
}

func (s ByteStream_SubstreamCallback_reachedLimit_Results) SetNext(v ByteStream) error {
	if !v.IsValid() {
		return capnp.Struct(s).SetPtr(0, capnp.Ptr{})
	}
	seg := s.Segment()
	in := capnp.NewInterface(seg, seg.Message().CapTable().Add(capnp.Client(v)))
	return capnp.Struct(s).SetPtr(0, in.ToPtr())
}

// ByteStream_SubstreamCallback_reachedLimit_Results_List is a list of ByteStream_SubstreamCallback_reachedLimit_Results.
type ByteStream_SubstreamCallback_reachedLimit_Results_List = capnp.StructList[ByteStream_SubstreamCallback_reachedLimit_Results]

// NewByteStream_SubstreamCallback_reachedLimit_Results creates a new list of ByteStream_SubstreamCallback_reachedLimit_Results.
func NewByteStream_SubstreamCallback_reachedLimit_Results_List(s *capnp.Segment, sz int32) (ByteStream_SubstreamCallback_reachedLimit_Results_List, error) {
	l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}, sz)
	return capnp.StructList[ByteStream_SubstreamCallback_reachedLimit_Results](l), err
}

// ByteStream_SubstreamCallback_reachedLimit_Results_Future is a wrapper for a ByteStream_SubstreamCallback_reachedLimit_Results promised by a client call.
type ByteStream_SubstreamCallback_reachedLimit_Results_Future struct{ *capnp.Future }

func (f ByteStream_SubstreamCallback_reachedLimit_Results_Future) Struct() (ByteStream_SubstreamCallback_reachedLimit_Results, error) {
	p, err := f.Future.Ptr()
	return ByteStream_SubstreamCallback_reachedLimit_Results(p.Struct()), err
}
func (p ByteStream_SubstreamCallback_reachedLimit_Results_Future) Next() ByteStream {
	return ByteStream(p.Future.Field(0, nil).Client())
}

type ByteStream_write_Params capnp.Struct

// ByteStream_write_Params_TypeID is the unique identifier for the type ByteStream_write_Params.
const ByteStream_write_Params_TypeID = 0xa45d8c4c07bb36d2

func NewByteStream_write_Params(s *capnp.Segment) (ByteStream_write_Params, error) {
	st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1})
	return ByteStream_write_Params(st), err
}

func NewRootByteStream_write_Params(s *capnp.Segment) (ByteStream_write_Params, error) {
	st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1})
	return ByteStream_write_Params(st), err
}

func ReadRootByteStream_write_Params(msg *capnp.Message) (ByteStream_write_Params, error) {
	root, err := msg.Root()
	return ByteStream_write_Params(root.Struct()), err
}

func (s ByteStream_write_Params) String() string {
	str, _ := text.Marshal(0xa45d8c4c07bb36d2, capnp.Struct(s))
	return str
}

func (s ByteStream_write_Params) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr {
	return capnp.Struct(s).EncodeAsPtr(seg)
}

func (ByteStream_write_Params) DecodeFromPtr(p capnp.Ptr) ByteStream_write_Params {
	return ByteStream_write_Params(capnp.Struct{}.DecodeFromPtr(p))
}

func (s ByteStream_write_Params) ToPtr() capnp.Ptr {
	return capnp.Struct(s).ToPtr()
}
func (s ByteStream_write_Params) IsValid() bool {
	return capnp.Struct(s).IsValid()
}

func (s ByteStream_write_Params) Message() *capnp.Message {
	return capnp.Struct(s).Message()
}

func (s ByteStream_write_Params) Segment() *capnp.Segment {
	return capnp.Struct(s).Segment()
}
func (s ByteStream_write_Params) Bytes() ([]byte, error) {
	p, err := capnp.Struct(s).Ptr(0)
	return []byte(p.Data()), err
}

func (s ByteStream_write_Params) HasBytes() bool {
	return capnp.Struct(s).HasPtr(0)
}

func (s ByteStream_write_Params) SetBytes(v []byte) error {
	return capnp.Struct(s).SetData(0, v)
}

// ByteStream_write_Params_List is a list of ByteStream_write_Params.
type ByteStream_write_Params_List = capnp.StructList[ByteStream_write_Params]

// NewByteStream_write_Params creates a new list of ByteStream_write_Params.
func NewByteStream_write_Params_List(s *capnp.Segment, sz int32) (ByteStream_write_Params_List, error) {
	l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}, sz)
	return capnp.StructList[ByteStream_write_Params](l), err
}

// ByteStream_write_Params_Future is a wrapper for a ByteStream_write_Params promised by a client call.
type ByteStream_write_Params_Future struct{ *capnp.Future }

func (f ByteStream_write_Params_Future) Struct() (ByteStream_write_Params, error) {
	p, err := f.Future.Ptr()
	return ByteStream_write_Params(p.Struct()), err
}

type ByteStream_end_Params capnp.Struct

// ByteStream_end_Params_TypeID is the unique identifier for the type ByteStream_end_Params.
const ByteStream_end_Params_TypeID = 0xcbd32047945c0144

func NewByteStream_end_Params(s *capnp.Segment) (ByteStream_end_Params, error) {
	st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0})
	return ByteStream_end_Params(st), err
}

func NewRootByteStream_end_Params(s *capnp.Segment) (ByteStream_end_Params, error) {
	st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0})
	return ByteStream_end_Params(st), err
}

func ReadRootByteStream_end_Params(msg *capnp.Message) (ByteStream_end_Params, error) {
	root, err := msg.Root()
	return ByteStream_end_Params(root.Struct()), err
}

func (s ByteStream_end_Params) String() string {
	str, _ := text.Marshal(0xcbd32047945c0144, capnp.Struct(s))
	return str
}

func (s ByteStream_end_Params) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr {
	return capnp.Struct(s).EncodeAsPtr(seg)
}

func (ByteStream_end_Params) DecodeFromPtr(p capnp.Ptr) ByteStream_end_Params {
	return ByteStream_end_Params(capnp.Struct{}.DecodeFromPtr(p))
}

func (s ByteStream_end_Params) ToPtr() capnp.Ptr {
	return capnp.Struct(s).ToPtr()
}
func (s ByteStream_end_Params) IsValid() bool {
	return capnp.Struct(s).IsValid()
}

func (s ByteStream_end_Params) Message() *capnp.Message {
	return capnp.Struct(s).Message()
}

func (s ByteStream_end_Params) Segment() *capnp.Segment {
	return capnp.Struct(s).Segment()
}

// ByteStream_end_Params_List is a list of ByteStream_end_Params.
type ByteStream_end_Params_List = capnp.StructList[ByteStream_end_Params]

// NewByteStream_end_Params creates a new list of ByteStream_end_Params.
func NewByteStream_end_Params_List(s *capnp.Segment, sz int32) (ByteStream_end_Params_List, error) {
	l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}, sz)
	return capnp.StructList[ByteStream_end_Params](l), err
}

// ByteStream_end_Params_Future is a wrapper for a ByteStream_end_Params promised by a client call.
type ByteStream_end_Params_Future struct{ *capnp.Future }

func (f ByteStream_end_Params_Future) Struct() (ByteStream_end_Params, error) {
	p, err := f.Future.Ptr()
	return ByteStream_end_Params(p.Struct()), err
}

type ByteStream_end_Results capnp.Struct

// ByteStream_end_Results_TypeID is the unique identifier for the type ByteStream_end_Results.
const ByteStream_end_Results_TypeID = 0xe7e2ddbc3c63d594

func NewByteStream_end_Results(s *capnp.Segment) (ByteStream_end_Results, error) {
	st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0})
	return ByteStream_end_Results(st), err
}

func NewRootByteStream_end_Results(s *capnp.Segment) (ByteStream_end_Results, error) {
	st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0})
	return ByteStream_end_Results(st), err
}

func ReadRootByteStream_end_Results(msg *capnp.Message) (ByteStream_end_Results, error) {
	root, err := msg.Root()
	return ByteStream_end_Results(root.Struct()), err
}

func (s ByteStream_end_Results) String() string {
	str, _ := text.Marshal(0xe7e2ddbc3c63d594, capnp.Struct(s))
	return str
}

func (s ByteStream_end_Results) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr {
	return capnp.Struct(s).EncodeAsPtr(seg)
}

func (ByteStream_end_Results) DecodeFromPtr(p capnp.Ptr) ByteStream_end_Results {
	return ByteStream_end_Results(capnp.Struct{}.DecodeFromPtr(p))
}

func (s ByteStream_end_Results) ToPtr() capnp.Ptr {
	return capnp.Struct(s).ToPtr()
}
func (s ByteStream_end_Results) IsValid() bool {
	return capnp.Struct(s).IsValid()
}

func (s ByteStream_end_Results) Message() *capnp.Message {
	return capnp.Struct(s).Message()
}

func (s ByteStream_end_Results) Segment() *capnp.Segment {
	return capnp.Struct(s).Segment()
}

// ByteStream_end_Results_List is a list of ByteStream_end_Results.
type ByteStream_end_Results_List = capnp.StructList[ByteStream_end_Results]

// NewByteStream_end_Results creates a new list of ByteStream_end_Results.
func NewByteStream_end_Results_List(s *capnp.Segment, sz int32) (ByteStream_end_Results_List, error) {
	l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}, sz)
	return capnp.StructList[ByteStream_end_Results](l), err
}

// ByteStream_end_Results_Future is a wrapper for a ByteStream_end_Results promised by a client call.
type ByteStream_end_Results_Future struct{ *capnp.Future }

func (f ByteStream_end_Results_Future) Struct() (ByteStream_end_Results, error) {
	p, err := f.Future.Ptr()
	return ByteStream_end_Results(p.Struct()), err
}

type ByteStream_getSubstream_Params capnp.Struct

// ByteStream_getSubstream_Params_TypeID is the unique identifier for the type ByteStream_getSubstream_Params.
const ByteStream_getSubstream_Params_TypeID = 0xc5b18e80fc80d9f8

func NewByteStream_getSubstream_Params(s *capnp.Segment) (ByteStream_getSubstream_Params, error) {
	st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1})
	return ByteStream_getSubstream_Params(st), err
}

func NewRootByteStream_getSubstream_Params(s *capnp.Segment) (ByteStream_getSubstream_Params, error) {
	st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1})
	return ByteStream_getSubstream_Params(st), err
}

func ReadRootByteStream_getSubstream_Params(msg *capnp.Message) (ByteStream_getSubstream_Params, error) {
	root, err := msg.Root()
	return ByteStream_getSubstream_Params(root.Struct()), err
}

func (s ByteStream_getSubstream_Params) String() string {
	str, _ := text.Marshal(0xc5b18e80fc80d9f8, capnp.Struct(s))
	return str
}

func (s ByteStream_getSubstream_Params) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr {
	return capnp.Struct(s).EncodeAsPtr(seg)
}

func (ByteStream_getSubstream_Params) DecodeFromPtr(p capnp.Ptr) ByteStream_getSubstream_Params {
	return ByteStream_getSubstream_Params(capnp.Struct{}.DecodeFromPtr(p))
}

func (s ByteStream_getSubstream_Params) ToPtr() capnp.Ptr {
	return capnp.Struct(s).ToPtr()
}
func (s ByteStream_getSubstream_Params) IsValid() bool {
	return capnp.Struct(s).IsValid()
}

func (s ByteStream_getSubstream_Params) Message() *capnp.Message {
	return capnp.Struct(s).Message()
}

func (s ByteStream_getSubstream_Params) Segment() *capnp.Segment {
	return capnp.Struct(s).Segment()
}
func (s ByteStream_getSubstream_Params) Callback() ByteStream_SubstreamCallback {
	p, _ := capnp.Struct(s).Ptr(0)
	return ByteStream_SubstreamCallback(p.Interface().Client())
}

func (s ByteStream_getSubstream_Params) HasCallback() bool {
	return capnp.Struct(s).HasPtr(0)
}

func (s ByteStream_getSubstream_Params) SetCallback(v ByteStream_SubstreamCallback) error {
	if !v.IsValid() {
		return capnp.Struct(s).SetPtr(0, capnp.Ptr{})
	}
	seg := s.Segment()
	in := capnp.NewInterface(seg, seg.Message().CapTable().Add(capnp.Client(v)))
	return capnp.Struct(s).SetPtr(0, in.ToPtr())
}

func (s ByteStream_getSubstream_Params) Limit() uint64 {
	return capnp.Struct(s).Uint64(0) ^ 18446744073709551615
}

func (s ByteStream_getSubstream_Params) SetLimit(v uint64) {
	capnp.Struct(s).SetUint64(0, v^18446744073709551615)
}

// ByteStream_getSubstream_Params_List is a list of ByteStream_getSubstream_Params.
type ByteStream_getSubstream_Params_List = capnp.StructList[ByteStream_getSubstream_Params]

// NewByteStream_getSubstream_Params creates a new list of ByteStream_getSubstream_Params.
func NewByteStream_getSubstream_Params_List(s *capnp.Segment, sz int32) (ByteStream_getSubstream_Params_List, error) {
	l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}, sz)
	return capnp.StructList[ByteStream_getSubstream_Params](l), err
}

// ByteStream_getSubstream_Params_Future is a wrapper for a ByteStream_getSubstream_Params promised by a client call.
type ByteStream_getSubstream_Params_Future struct{ *capnp.Future }

func (f ByteStream_getSubstream_Params_Future) Struct() (ByteStream_getSubstream_Params, error) {
	p, err := f.Future.Ptr()
	return ByteStream_getSubstream_Params(p.Struct()), err
}
func (p ByteStream_getSubstream_Params_Future) Callback() ByteStream_SubstreamCallback {
	return ByteStream_SubstreamCallback(p.Future.Field(0, nil).Client())
}

type ByteStream_getSubstream_Results capnp.Struct

// ByteStream_getSubstream_Results_TypeID is the unique identifier for the type ByteStream_getSubstream_Results.
const ByteStream_getSubstream_Results_TypeID = 0x8d198ede6d27756a

func NewByteStream_getSubstream_Results(s *capnp.Segment) (ByteStream_getSubstream_Results, error) {
	st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1})
	return ByteStream_getSubstream_Results(st), err
}

func NewRootByteStream_getSubstream_Results(s *capnp.Segment) (ByteStream_getSubstream_Results, error) {
	st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1})
	return ByteStream_getSubstream_Results(st), err
}

func ReadRootByteStream_getSubstream_Results(msg *capnp.Message) (ByteStream_getSubstream_Results, error) {
	root, err := msg.Root()
	return ByteStream_getSubstream_Results(root.Struct()), err
}

func (s ByteStream_getSubstream_Results) String() string {
	str, _ := text.Marshal(0x8d198ede6d27756a, capnp.Struct(s))
	return str
}

func (s ByteStream_getSubstream_Results) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr {
	return capnp.Struct(s).EncodeAsPtr(seg)
}

func (ByteStream_getSubstream_Results) DecodeFromPtr(p capnp.Ptr) ByteStream_getSubstream_Results {
	return ByteStream_getSubstream_Results(capnp.Struct{}.DecodeFromPtr(p))
}

func (s ByteStream_getSubstream_Results) ToPtr() capnp.Ptr {
	return capnp.Struct(s).ToPtr()
}
func (s ByteStream_getSubstream_Results) IsValid() bool {
	return capnp.Struct(s).IsValid()
}

func (s ByteStream_getSubstream_Results) Message() *capnp.Message {
	return capnp.Struct(s).Message()
}

func (s ByteStream_getSubstream_Results) Segment() *capnp.Segment {
	return capnp.Struct(s).Segment()
}
func (s ByteStream_getSubstream_Results) Substream() ByteStream {
	p, _ := capnp.Struct(s).Ptr(0)
	return ByteStream(p.Interface().Client())
}

func (s ByteStream_getSubstream_Results) HasSubstream() bool {
	return capnp.Struct(s).HasPtr(0)
}

func (s ByteStream_getSubstream_Results) SetSubstream(v ByteStream) error {
	if !v.IsValid() {
		return capnp.Struct(s).SetPtr(0, capnp.Ptr{})
	}
	seg := s.Segment()
	in := capnp.NewInterface(seg, seg.Message().CapTable().Add(capnp.Client(v)))
	return capnp.Struct(s).SetPtr(0, in.ToPtr())
}

// ByteStream_getSubstream_Results_List is a list of ByteStream_getSubstream_Results.
type ByteStream_getSubstream_Results_List = capnp.StructList[ByteStream_getSubstream_Results]

// NewByteStream_getSubstream_Results creates a new list of ByteStream_getSubstream_Results.
func NewByteStream_getSubstream_Results_List(s *capnp.Segment, sz int32) (ByteStream_getSubstream_Results_List, error) {
	l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}, sz)
	return capnp.StructList[ByteStream_getSubstream_Results](l), err
}

// ByteStream_getSubstream_Results_Future is a wrapper for a ByteStream_getSubstream_Results promised by a client call.
type ByteStream_getSubstream_Results_Future struct{ *capnp.Future }

func (f ByteStream_getSubstream_Results_Future) Struct() (ByteStream_getSubstream_Results, error) {
	p, err := f.Future.Ptr()
	return ByteStream_getSubstream_Results(p.Struct()), err
}
func (p ByteStream_getSubstream_Results_Future) Substream() ByteStream {
	return ByteStream(p.Future.Field(0, nil).Client())
}

type ByteStream_startTls_Params capnp.Struct

// ByteStream_startTls_Params_TypeID is the unique identifier for the type ByteStream_startTls_Params.
const ByteStream_startTls_Params_TypeID = 0xea8253a695da1ab8

func NewByteStream_startTls_Params(s *capnp.Segment) (ByteStream_startTls_Params, error) {
	st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1})
	return ByteStream_startTls_Params(st), err
}

func NewRootByteStream_startTls_Params(s *capnp.Segment) (ByteStream_startTls_Params, error) {
	st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1})
	return ByteStream_startTls_Params(st), err
}

func ReadRootByteStream_startTls_Params(msg *capnp.Message) (ByteStream_startTls_Params, error) {
	root, err := msg.Root()
	return ByteStream_startTls_Params(root.Struct()), err
}

func (s ByteStream_startTls_Params) String() string {
	str, _ := text.Marshal(0xea8253a695da1ab8, capnp.Struct(s))
	return str
}

func (s ByteStream_startTls_Params) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr {
	return capnp.Struct(s).EncodeAsPtr(seg)
}

func (ByteStream_startTls_Params) DecodeFromPtr(p capnp.Ptr) ByteStream_startTls_Params {
	return ByteStream_startTls_Params(capnp.Struct{}.DecodeFromPtr(p))
}

func (s ByteStream_startTls_Params) ToPtr() capnp.Ptr {
	return capnp.Struct(s).ToPtr()
}
func (s ByteStream_startTls_Params) IsValid() bool {
	return capnp.Struct(s).IsValid()
}

func (s ByteStream_startTls_Params) Message() *capnp.Message {
	return capnp.Struct(s).Message()
}

func (s ByteStream_startTls_Params) Segment() *capnp.Segment {
	return capnp.Struct(s).Segment()
}
func (s ByteStream_startTls_Params) ExpectedServerHostname() (string, error) {
	p, err := capnp.Struct(s).Ptr(0)
	return p.Text(), err
}

func (s ByteStream_startTls_Params) HasExpectedServerHostname() bool {
	return capnp.Struct(s).HasPtr(0)
}

func (s ByteStream_startTls_Params) ExpectedServerHostnameBytes() ([]byte, error) {
	p, err := capnp.Struct(s).Ptr(0)
	return p.TextBytes(), err
}

func (s ByteStream_startTls_Params) SetExpectedServerHostname(v string) error {
	return capnp.Struct(s).SetText(0, v)
}

// ByteStream_startTls_Params_List is a list of ByteStream_startTls_Params.
type ByteStream_startTls_Params_List = capnp.StructList[ByteStream_startTls_Params]

// NewByteStream_startTls_Params creates a new list of ByteStream_startTls_Params.
func NewByteStream_startTls_Params_List(s *capnp.Segment, sz int32) (ByteStream_startTls_Params_List, error) {
	l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}, sz)
	return capnp.StructList[ByteStream_startTls_Params](l), err
}

// ByteStream_startTls_Params_Future is a wrapper for a ByteStream_startTls_Params promised by a client call.
type ByteStream_startTls_Params_Future struct{ *capnp.Future }

func (f ByteStream_startTls_Params_Future) Struct() (ByteStream_startTls_Params, error) {
	p, err := f.Future.Ptr()
	return ByteStream_startTls_Params(p.Struct()), err
}

const schema_8f5d14e1c273738d = "x\xda\xa4\x94_h\x1cU\x18\xc5\xcf\x99\xb9\xd3\xe9\x9f" +
	"\x84\xedu\x02\xdab\x88\x94\x14\xff`Z\xd3U\xa9R" +
	"\xd8\xb5)\xa8\xa1\xc2\xdel)\x16,e\xb2{\xabI" +
	"w\xa7\xc9\xcc\xaci\x84B\x11D,6\xa5\xa1A\xf4" +
	"\xc9\x07\xf1=BE\xab\x0f\xfe\xa1/UP+B\x15" +
	"+X\x90@\xc4'\x11\x14\x0b#w63\xd9\x94H" +
	"\x0c\xee\xdb\xce|\xf3\x9d\xdf\xfd\xce\xf9\xeeC\xb7X\x16" +
	"\x83\xdd%\x17\x96:\xe4lH\xc6[\xf76\x7f\x9a\xd9" +
	"v\x0e\xb2\x97\x80C\x17(\xbeb\xcf\x12\xf4\xe6\xec\x12" +
	"\x98\\{\xf4#\xf7\xe0\xebG\xdf\xe9,\xf8\xd0\x1e1" +
	"\x05W\xd2\x82\xe0s\xfd\x95\xb7y\xdf{\x90\xbdvr" +
	"\xfc\x8d\xcd?\xbe}}\xe1\x1a\xc0\xe2/\xf6K\xf4\xfe" +
	"\xb2]\xc0\xfb\xc3~\xd5{Z\xb8@20\xfb\xfe\xa5" +
	"\xc3\xbf\x9e\xbf\x0c\xb9\x9b\x80yT\x1c\x14\x8b\x84H\xfe" +
	"\xfc\xfe\xcc\xad33\xf3W\xa0z\x99+\xed\x14g\x8d" +
	"\xd2#b\x0aL\x0e\xf0\xb9\x8bO\xde\xf3\xed\x17m\x94" +
	"\xf4\xdb9\xb1\xdf|\xbb\xf0\xf7\xd5\xb3Wg\xe6\xbf\x84" +
	"\xda\xcd\xec\xd5iq\xd3|zA\x18\xc8\x9cK\xdea" +
	"'\xe7\xa2\xe8\xb3\x9f{\x8e\x9e\x07\xe8]\x12\x8b\xde\xa7" +
	"\xe2N\xa0\xf8\x8dp\xe9M;\x06\xf2\xc0\xb1g'\x0f" +
	"\xff\xbe\xe5z\x07\xa4\xefl\xb7 \x92\xeaP\xcfo{" +
	"\x8f\x7f}\xa3\xfd\xa6\xcdx\xc4\xd9a\x81\xde\xa4c\x84" +
	".~W\xdb\xf7\xf1\x8d\x9b\x0b\x1d\x8c\x17\x9ca\xc3\xf8" +
	"\xc1\xf6\x1f\xe6\xde\xad\xbe\xbc\xd89\xc8\xd3\xce\xb8a|" +
	"\xcd)\xa1\x9e\x8cN\xc7z \x8aCG\xfb\xcd]5" +
	"\x7f\"\x98x|\xfft\xac\xabqh\x1e<\xaf\xe3j" +
	"k4J\xff\xf4\x8f\xe8\xa8\xd5\x88\x19)a\x0b@\x10" +
	"\x90\xdd#\x80\xea\xb2\xa9\xee\xb2\x98DK\x95`\x93\xb2" +
	"\xd3\x14J0\x17\x12\xab\x0aM\x85c\xb1\xee\xaf\xf8\xa1" +
	"\xdf\\)\xb0\x07P\x1bm\xaa\x1e\x8b}\xa6E\xc4n" +
	"X\xec^\xb3a\x8e=\xe4\x97\x1a\x8dQ\xbfv\xa2B" +
	"\xaa\x8d\xb6\x03\xe4\xc61\xcb\x85\x1c\xdc\x03K\xeet\xc9" +
	"\xdc\x05fC\x97\xdb\xc6aI\xe9\xf6\xe9\xa0\xae\xebe" +
	"&\xa1\xf6k/\xe8\xfaA\x14\xc6\x9acq\x99\x15." +
	"\xb3lX\x8b\xa5\x8d\xb2+\xede\x06Zh5\xe2h" +
	"=&\xa4#\x8a\xd2\xa1d3\xba\x7f\x18P\xf7\xd9T" +
	"\x0f[${H\xd2\x1c\x08\xeaA\x9bj\xaf\xc5\xa4\xb6" +
	"$\x0b\x80ryu\xda\xc6\xf45\xcc1\xb8\x09\x167" +
	"%\xd9\x0f@\x0e\xb5eU(\x1d\xd43\x96\xacp]" +
	"g\xaf\xf8\xa1\xeb7\xff5K\xa6\xe7\xd0\xc9V\x00." +
	"\xa1u\x18n\xdd.T0\xfd\x95`\xe7\xb5\xc0\xd9$" +
	"\x93f\xa6\xcd\x13jk\x1a\x80\xecza0\xff\xc9T" +
	"\xf1\xadco\xcaI\x13\x00\x9d\x06`i\xdf\x99-\x95" +
	"<\xb2\x03\x96|\xc6\xa5\x95\xdf\x16\xcc.0\xf9\x84\x09" +
	"\xc7c.\xed|\xd3\x96{\x0e\x0c\xa7\xa1\xeaK\xb3]" +
	"\xa6\xab\x03\x13\x9f\xccM\xa4\xd4e&Q\xec\x87\xf1\xa1" +
	"F\x04`e\x98\xdc\xff8\xd0,\x90\xc6\xc7\xd4\x13\xbb" +
	"\x19\xfd\xbf&f\xd3\xddF\xbc\xc2\x9d\x07\x96\x17\xb1\x10" +
	"\xe8S\xf1\xbaW\xdc$\xa6}\x85D\x1d\xe9Z\xbd6" +
	"\x9bI\x7f\xc5/\x84\xb7\xc5\xe42\xa0\xb6\xdaTw[" +
	"L\xf4\xa9\x09]\x8bu\x9dU\x1d\xbe\xa8\xc3\xa7N\x96" +
	"\xa28\xf0\x9b\x9a]\xb0\xd8\x05\xfe\x13\x00\x00\xff\xff\xbf" +
	"\x0c\x05)"

func RegisterSchema(reg *schemas.Registry) {
	reg.Register(&schemas.Schema{
		String: schema_8f5d14e1c273738d,
		Nodes: []uint64{
			0x8d198ede6d27756a,
			0xa45d8c4c07bb36d2,
			0xb23c0a13cf65c36e,
			0xba8feb56b5b6922d,
			0xc5b18e80fc80d9f8,
			0xcbd32047945c0144,
			0xccb18eca8acafbe7,
			0xd2e7d8a0dc0a9766,
			0xd80bf35671585f44,
			0xddd06638ed144353,
			0xe7e2ddbc3c63d594,
			0xea8253a695da1ab8,
		},
		Compressed: true,
	})
}
