Documentation ¶
Index ¶
- Variables
- type CBuffer
- type Ping
- type Pong
- type ResultCode
- type RustFfi
- type RustFfiImpl
- type RustFfiResult
- func (r RustFfiResult[T]) AsError() error
- func (r RustFfiResult[T]) IsOk() bool
- func (r RustFfiResult[T]) JsonUnmarshal() (*T, error)
- func (r RustFfiResult[T]) JsonUnmarshalUnchecked() *T
- func (r RustFfiResult[T]) PbUnmarshal() (*T, error)
- func (r RustFfiResult[T]) PbUnmarshalUnchecked() *T
- func (r RustFfiResult[T]) String() string
- func (r RustFfiResult[T]) Unmarshal(unmarshal func([]byte, any) error) (*T, error)
- func (r RustFfiResult[T]) UnmarshalUnchecked(unmarshal func([]byte, any) error) *T
- type TBytes
- func TBytesFromBytes[T any](bytes []byte) TBytes[T]
- func TBytesFromJson[T any](obj T) (TBytes[T], error)
- func TBytesFromJsonUnchecked[T proto.Message](obj T) TBytes[T]
- func TBytesFromPb[T proto.Message](obj T) (TBytes[T], error)
- func TBytesFromPbUnchecked[T proto.Message](obj T) TBytes[T]
- func TBytesFromString[T any](s string) TBytes[T]
- func (b TBytes[T]) ForCBuffer() (unsafe.Pointer, int)
- func (b TBytes[T]) JsonUnmarshal() (*T, error)
- func (b TBytes[T]) JsonUnmarshalUnchecked() *T
- func (b TBytes[T]) Len() int
- func (b TBytes[T]) PbUnmarshal() (*T, error)
- func (b TBytes[T]) PbUnmarshalUnchecked() *T
- func (b TBytes[T]) Unmarshal(unmarshal func([]byte, any) error) (*T, error)
- func (b TBytes[T]) UnmarshalUnchecked(unmarshal func([]byte, any) error) *T
Constants ¶
This section is empty.
Variables ¶
var File_echo_pb_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type CBuffer ¶
type CBuffer struct {
// contains filtered or unexported fields
}
CBuffer Rust buffer for Go
type Ping ¶
type Ping struct { Msg string `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,omitempty"` // contains filtered or unexported fields }
func (*Ping) Descriptor
deprecated
func (*Ping) ProtoMessage ¶
func (*Ping) ProtoMessage()
func (*Ping) ProtoReflect ¶
func (x *Ping) ProtoReflect() protoreflect.Message
type Pong ¶
type Pong struct { Msg string `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,omitempty"` // contains filtered or unexported fields }
func (*Pong) Descriptor
deprecated
func (*Pong) ProtoMessage ¶
func (*Pong) ProtoMessage()
func (*Pong) ProtoReflect ¶
func (x *Pong) ProtoReflect() protoreflect.Message
type ResultCode ¶
type ResultCode = int8
const ( RcNoError ResultCode = 0 RcDecode ResultCode = -1 RcEncode ResultCode = -2 RcUnknown ResultCode = -128 )
type RustFfi ¶
type RustFfi interface {
EchoRs(req TBytes[*Ping]) RustFfiResult[Pong]
}
var GlobalRustFfi RustFfi = RustFfiImpl{}
type RustFfiImpl ¶
type RustFfiImpl struct{}
func (RustFfiImpl) EchoRs ¶
func (RustFfiImpl) EchoRs(req TBytes[*Ping]) RustFfiResult[Pong]
type RustFfiResult ¶
type RustFfiResult[T any] struct { CBuffer Code ResultCode // contains filtered or unexported fields }
RustFfiResult Rust FFI Result for Go NOTE: must call Free method to free rust memory buffer!
func (RustFfiResult[T]) AsError ¶
func (r RustFfiResult[T]) AsError() error
AsError as an error NOTE: reference Rust memory buffer
func (RustFfiResult[T]) IsOk ¶
func (r RustFfiResult[T]) IsOk() bool
func (RustFfiResult[T]) JsonUnmarshal ¶
func (r RustFfiResult[T]) JsonUnmarshal() (*T, error)
JsonUnmarshal as json to unmarshal NOTE: maybe reference Rust memory buffer
func (RustFfiResult[T]) JsonUnmarshalUnchecked ¶
func (r RustFfiResult[T]) JsonUnmarshalUnchecked() *T
JsonUnmarshalUnchecked as json to unmarshal NOTE: maybe reference Rust memory buffer
func (RustFfiResult[T]) PbUnmarshal ¶
func (r RustFfiResult[T]) PbUnmarshal() (*T, error)
PbUnmarshal as protobuf to unmarshal NOTE: maybe reference Rust memory buffer
func (RustFfiResult[T]) PbUnmarshalUnchecked ¶
func (r RustFfiResult[T]) PbUnmarshalUnchecked() *T
PbUnmarshalUnchecked as protobuf to unmarshal NOTE: maybe reference Rust memory buffer
func (RustFfiResult[T]) String ¶
func (r RustFfiResult[T]) String() string
func (RustFfiResult[T]) Unmarshal ¶
func (r RustFfiResult[T]) Unmarshal(unmarshal func([]byte, any) error) (*T, error)
Unmarshal unmarshal to object NOTE: maybe reference Rust memory buffer
func (RustFfiResult[T]) UnmarshalUnchecked ¶
func (r RustFfiResult[T]) UnmarshalUnchecked(unmarshal func([]byte, any) error) *T
UnmarshalUnchecked unmarshal to object NOTE: maybe reference Rust memory buffer
type TBytes ¶
type TBytes[T any] struct { // contains filtered or unexported fields }
TBytes bytes with type marker
func TBytesFromBytes ¶
TBytesFromBytes new TBytes from bytes
func TBytesFromJson ¶
func TBytesFromJsonUnchecked ¶
func TBytesFromPbUnchecked ¶
func TBytesFromString ¶
TBytesFromString new TBytes from string
func (TBytes[T]) JsonUnmarshal ¶
JsonUnmarshal as json to unmarshal NOTE: maybe reference Rust memory buffer
func (TBytes[T]) JsonUnmarshalUnchecked ¶
func (b TBytes[T]) JsonUnmarshalUnchecked() *T
JsonUnmarshalUnchecked as json to unmarshal NOTE: maybe reference Rust memory buffer
func (TBytes[T]) PbUnmarshal ¶
PbUnmarshal as protobuf to unmarshal NOTE: maybe reference Rust memory buffer
func (TBytes[T]) PbUnmarshalUnchecked ¶
func (b TBytes[T]) PbUnmarshalUnchecked() *T
PbUnmarshalUnchecked as protobuf to unmarshal NOTE: maybe reference Rust memory buffer