This repository has been archived on 2024-07-06. You can view files and clone it, but cannot push or open issues or pull requests.
go-playit/proto/raw_slice.go
Matheus Sampaio Queiroga c756fc28b0
Update to same code from rust agent
Signed-off-by: Matheus Sampaio Queiroga <srherobrine20@gmail.com>
2024-05-24 23:28:31 -03:00

22 lines
377 B
Go

package proto
import (
"fmt"
"io"
)
type RawSlice []byte
func (buff RawSlice) ReadFrom(r io.Reader) error {
return fmt.Errorf("cannot read for RawSlice")
}
func (buff RawSlice) WriteTo(w io.Writer) error {
size, err := w.Write(buff)
if err != nil {
return err
} else if size != len(buff) {
return fmt.Errorf("not enough space to write raw slice")
}
return nil
}