This commit is contained in:
Bel LaPointe
2019-02-18 09:31:35 -07:00
commit cbf886fb7e
14 changed files with 1016 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
package packable
type Packable interface {
Encode() ([]byte, error)
Decode([]byte) error
}
type String string
func (s *String) String() string {
return string(*s)
}
func (s *String) Encode() ([]byte, error) {
return []byte(*s), nil
}
func (s *String) Decode(b []byte) error {
*s = String(string(b))
return nil
}
func NewString(s string) *String {
w := String(s)
return &w
}