Help us shape the future of Go! Take the 2026 Go Developer Survey

example

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2026 License: CC0-1.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TransactionIPingServicePing = binder.FirstCallTransaction + 0
	TransactionIPingServiceEcho = binder.FirstCallTransaction + 1
)
View Source
const (
	MethodIPingServicePing = "ping"
	MethodIPingServiceEcho = "echo"
)
View Source
const DescriptorIPingService = "com.example.IPingService"

Variables

This section is empty.

Functions

This section is empty.

Types

type IPingService

type IPingService interface {
	AsBinder() binder.IBinder
	Ping(ctx context.Context) (string, error)
	Echo(ctx context.Context, message string) (string, error)
}

func NewPingServiceStub

func NewPingServiceStub(
	impl IPingServiceServer,
) IPingService

NewPingServiceStub creates a server-side IPingService wrapping the given server implementation. The returned value satisfies IPingService and can be passed to proxy methods; its AsBinder() returns a *binder.StubBinder that is auto-registered with the binder driver on first use.

type IPingServiceServer

type IPingServiceServer interface {
	Ping(ctx context.Context) (string, error)
	Echo(ctx context.Context, message string) (string, error)
}

IPingServiceServer is the server-side interface that user implementations provide to NewPingServiceStub. It contains only the business methods, without AsBinder (which is provided by the stub itself).

type PingServiceProxy

type PingServiceProxy struct {
	Remote binder.IBinder
}

func NewPingServiceProxy

func NewPingServiceProxy(
	remote binder.IBinder,
) *PingServiceProxy

func (*PingServiceProxy) AsBinder

func (p *PingServiceProxy) AsBinder() binder.IBinder

func (*PingServiceProxy) Echo

func (p *PingServiceProxy) Echo(
	ctx context.Context,
	message string,
) (string, error)

func (*PingServiceProxy) Ping

func (p *PingServiceProxy) Ping(
	ctx context.Context,
) (string, error)

type PingServiceStub

type PingServiceStub struct {
	Impl      IPingService
	Transport binder.VersionAwareTransport
}

PingServiceStub dispatches incoming binder transactions to a typed IPingService implementation.

func (*PingServiceStub) Descriptor

func (s *PingServiceStub) Descriptor() string

func (*PingServiceStub) OnTransaction

func (s *PingServiceStub) OnTransaction(
	ctx context.Context,
	code binder.TransactionCode,
	_data *parcel.Parcel,
) (*parcel.Parcel, error)

Jump to

Keyboard shortcuts

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