Files
Alessandro ScandoneandGitHub 5dfc34cd3c feat: feature flag syntax (#120)
* feat: feature flag syntax

* feat: change syntax

* feat: reject invalid features

* feat: add static check of unknown features

* feat: more defensive args handling

* fix: fix typo
2026-03-04 13:32:35 +00:00

32 lines
560 B
Go

package jsonrpc2
// This is mostly intented as a testing utility
type ChanObjStream struct {
in <-chan Message
out chan<- Message
}
var _ MessageStream = (*ChanObjStream)(nil)
func NewChanObjStream(in <-chan Message, out chan<- Message) *ChanObjStream {
return &ChanObjStream{
in: in,
out: out,
}
}
func (c *ChanObjStream) Close() error {
close(c.out)
return nil
}
func (c *ChanObjStream) ReadMessage() (Message, error) {
msg := <-c.in
return msg, nil
}
func (c *ChanObjStream) WriteMessage(obj Message) error {
c.out <- obj
return nil
}