proto

package
v0.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package proto is the hello app's wire schema: every message between its Go code and its iOS / Android hosts. `nimbus native gen` (run by every build) generates wire_gen.go here and the Swift / Java types.

Index

Constants

View Source
const SchemaHash uint64 = 0x419f25d7cbd57b3f

SchemaHash identifies this schema's wire layout. Hosts pass it (combined with any other schemas) to nn_start, which refuses a mismatch.

Variables

This section is empty.

Functions

func AppendMessage

func AppendMessage(b []byte, v Message) []byte

AppendMessage appends a Message: its variant index (0 for nil), then the variant.

func Encode

func Encode(m Message) []byte

Encode returns m's wire encoding: its message id, then its fields.

Types

type Ack

type Ack struct{ OK bool }

func (*Ack) AppendWire

func (m *Ack) AppendWire(b []byte) []byte

AppendWire appends m's wire encoding to b.

func (*Ack) ReadWire

func (m *Ack) ReadWire(r *wire.Reader)

ReadWire decodes m from r. Check r.Err() afterwards.

type Crash

type Crash struct{ Reason string }

Crash makes the Go handler panic, to check panic reporting.

func (*Crash) AppendWire

func (m *Crash) AppendWire(b []byte) []byte

AppendWire appends m's wire encoding to b.

func (*Crash) ReadWire

func (m *Crash) ReadWire(r *wire.Reader)

ReadWire decodes m from r. Check r.Err() afterwards.

type Echo

type Echo struct{ Text string }

Echo comes back unchanged (sync call; used for call benchmarks).

func (*Echo) AppendWire

func (m *Echo) AppendWire(b []byte) []byte

AppendWire appends m's wire encoding to b.

func (*Echo) ReadWire

func (m *Echo) ReadWire(r *wire.Reader)

ReadWire decodes m from r. Check r.Err() afterwards.

type Greeting

type Greeting struct{ Text, GoVersion, Platform string }

Greeting answers Hello.

func (*Greeting) AppendWire

func (m *Greeting) AppendWire(b []byte) []byte

AppendWire appends m's wire encoding to b.

func (*Greeting) ReadWire

func (m *Greeting) ReadWire(r *wire.Reader)

ReadWire decodes m from r. Check r.Err() afterwards.

type Hello

type Hello struct{ Name string }

Hello asks Go to greet someone (sync call).

func (*Hello) AppendWire

func (m *Hello) AppendWire(b []byte) []byte

AppendWire appends m's wire encoding to b.

func (*Hello) ReadWire

func (m *Hello) ReadWire(r *wire.Reader)

ReadWire decodes m from r. Check r.Err() afterwards.

type Item

type Item struct{ Index uint32 }

func (*Item) AppendWire

func (m *Item) AppendWire(b []byte) []byte

AppendWire appends m's wire encoding to b.

func (*Item) ReadWire

func (m *Item) ReadWire(r *wire.Reader)

ReadWire decodes m from r. Check r.Err() afterwards.

type Kind

type Kind uint8

Kind is what a Row shows.

const (
	KindText Kind = iota
	KindImage
	KindButton
)

type Message

type Message interface {
	// contains filtered or unexported methods
}

Message is any top-level message in this schema.

func Decode

func Decode(b []byte) (Message, error)

Decode reads exactly one message.

func ReadMessage

func ReadMessage(r *wire.Reader) Message

ReadMessage decodes a Message (nil for index 0).

type Ping

type Ping struct{ Seq uint32 }

func (*Ping) AppendWire

func (m *Ping) AppendWire(b []byte) []byte

AppendWire appends m's wire encoding to b.

func (*Ping) ReadWire

func (m *Ping) ReadWire(r *wire.Reader)

ReadWire decodes m from r. Check r.Err() afterwards.

type Pong

type Pong struct{ Seq uint32 }

func (*Pong) AppendWire

func (m *Pong) AppendWire(b []byte) []byte

AppendWire appends m's wire encoding to b.

func (*Pong) ReadWire

func (m *Pong) ReadWire(r *wire.Reader)

ReadWire decodes m from r. Check r.Err() afterwards.

type Ready

type Ready struct{ GoVersion string }

Ready is the first message Go sends after start.

func (*Ready) AppendWire

func (m *Ready) AppendWire(b []byte) []byte

AppendWire appends m's wire encoding to b.

func (*Ready) ReadWire

func (m *Ready) ReadWire(r *wire.Reader)

ReadWire decodes m from r. Check r.Err() afterwards.

type Row

type Row struct {
	ID       uint32
	Title    string
	Subtitle *string
	Kind     Kind
	Score    float64
	Tags     []string
	Attrs    map[string]string
}

Row is one list item: the kind of data a UI batch carries.

func (*Row) AppendWire

func (m *Row) AppendWire(b []byte) []byte

AppendWire appends m's wire encoding to b.

func (*Row) ReadWire

func (m *Row) ReadWire(r *wire.Reader)

ReadWire decodes m from r. Check r.Err() afterwards.

type Snapshot

type Snapshot struct{ Rows []Row }

func (*Snapshot) AppendWire

func (m *Snapshot) AppendWire(b []byte) []byte

AppendWire appends m's wire encoding to b.

func (*Snapshot) ReadWire

func (m *Snapshot) ReadWire(r *wire.Reader)

ReadWire decodes m from r. Check r.Err() afterwards.

type SnapshotRequest

type SnapshotRequest struct{ Rows uint32 }

SnapshotRequest asks for a list shaped like real screen data.

func (*SnapshotRequest) AppendWire

func (m *SnapshotRequest) AppendWire(b []byte) []byte

AppendWire appends m's wire encoding to b.

func (*SnapshotRequest) ReadWire

func (m *SnapshotRequest) ReadWire(r *wire.Reader)

ReadWire decodes m from r. Check r.Err() afterwards.

type StartBurst

type StartBurst struct{ Count uint32 }

StartBurst makes Go send Count Items as fast as it can.

func (*StartBurst) AppendWire

func (m *StartBurst) AppendWire(b []byte) []byte

AppendWire appends m's wire encoding to b.

func (*StartBurst) ReadWire

func (m *StartBurst) ReadWire(r *wire.Reader)

ReadWire decodes m from r. Check r.Err() afterwards.

type Stats

type Stats struct {
	Heap                uint64
	Goroutines          uint32
	Sent, Wakes, Drains uint64
}

Stats is bridge traffic and Go memory (bridge.ReadStats).

func (*Stats) AppendWire

func (m *Stats) AppendWire(b []byte) []byte

AppendWire appends m's wire encoding to b.

func (*Stats) ReadWire

func (m *Stats) ReadWire(r *wire.Reader)

ReadWire decodes m from r. Check r.Err() afterwards.

type StatsRequest

type StatsRequest struct{ GC bool }

func (*StatsRequest) AppendWire

func (m *StatsRequest) AppendWire(b []byte) []byte

AppendWire appends m's wire encoding to b.

func (*StatsRequest) ReadWire

func (m *StatsRequest) ReadWire(r *wire.Reader)

ReadWire decodes m from r. Check r.Err() afterwards.

type Tick

type Tick struct{ N uint32 }

Tick is sent from a goroutine the host never created.

func (*Tick) AppendWire

func (m *Tick) AppendWire(b []byte) []byte

AppendWire appends m's wire encoding to b.

func (*Tick) ReadWire

func (m *Tick) ReadWire(r *wire.Reader)

ReadWire decodes m from r. Check r.Err() afterwards.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL