mirror of
https://github.com/zap-proto/web.git
synced 2026-10-30 15:03:09 +00:00
Aligns with the zap-proto org canonical naming. No code changes; import paths flipped, dep entry renamed, alias updated.
69 lines
1.8 KiB
TypeScript
69 lines
1.8 KiB
TypeScript
// Code generated by zapgen --target=ts; DO NOT EDIT.
|
|
// source: echo.zap
|
|
|
|
import { Builder, Message, StructView } from "@zap-proto/zap";
|
|
|
|
const echoArgsOff = {
|
|
Msg: 0,
|
|
} as const;
|
|
const echoArgsSize = 8;
|
|
|
|
/** Zero-copy view into a ZAP-encoded EchoArgs message. */
|
|
export class EchoArgs extends StructView {
|
|
/** Parse `b` and return a typed view. Throws on a wire-level check failure (magic, version, size). */
|
|
static wrap(b: Uint8Array): EchoArgs {
|
|
const root = Message.parse(b).root();
|
|
return new EchoArgs(root.data, root.offset);
|
|
}
|
|
|
|
get msg(): string {
|
|
return this.text(echoArgsOff.Msg);
|
|
}
|
|
}
|
|
|
|
/** Field values for newEchoArgs. */
|
|
export interface EchoArgsInput {
|
|
msg: string;
|
|
}
|
|
|
|
/** Build a ZAP-encoded EchoArgs message from `in` and return the bytes. */
|
|
export function newEchoArgs(in_: EchoArgsInput): Uint8Array {
|
|
const b = new Builder(256);
|
|
const ob = b.startObject(echoArgsSize);
|
|
ob.setText(echoArgsOff.Msg, in_.msg);
|
|
ob.finishAsRoot();
|
|
return b.finish();
|
|
}
|
|
|
|
const echoResultOff = {
|
|
Msg: 0,
|
|
} as const;
|
|
const echoResultSize = 8;
|
|
|
|
/** Zero-copy view into a ZAP-encoded EchoResult message. */
|
|
export class EchoResult extends StructView {
|
|
/** Parse `b` and return a typed view. Throws on a wire-level check failure (magic, version, size). */
|
|
static wrap(b: Uint8Array): EchoResult {
|
|
const root = Message.parse(b).root();
|
|
return new EchoResult(root.data, root.offset);
|
|
}
|
|
|
|
get msg(): string {
|
|
return this.text(echoResultOff.Msg);
|
|
}
|
|
}
|
|
|
|
/** Field values for newEchoResult. */
|
|
export interface EchoResultInput {
|
|
msg: string;
|
|
}
|
|
|
|
/** Build a ZAP-encoded EchoResult message from `in` and return the bytes. */
|
|
export function newEchoResult(in_: EchoResultInput): Uint8Array {
|
|
const b = new Builder(256);
|
|
const ob = b.startObject(echoResultSize);
|
|
ob.setText(echoResultOff.Msg, in_.msg);
|
|
ob.finishAsRoot();
|
|
return b.finish();
|
|
}
|