Initial release.
This commit is contained in:
brent saner committed 2024-07-10 00:18:54 -04:00
1 parent 7ce62f8107
commit d4bb259b83
27 files changed
+4673 -12

No files matched your search

+75
View File
@@ -0,0 +1,75 @@
package wireproto
// MarshalBinary renders a FieldName into a byte-packed format.
func (f *FieldName) MarshalBinary() (data []byte, err error) {
if f == nil {
data = []byte{}
return
}
data = []byte(*f)
return
}
// MarshalText renders a FieldName into plaintext.
func (f *FieldName) MarshalText() (data []byte, err error) {
if f == nil {
data = []byte{}
return
}
data = []byte(*f)
return
}
// UnmarshalBinary populates a FieldName from packed bytes.
func (f *FieldName) UnmarshalBinary(data []byte) (err error) {
if data == nil || len(data) == 0 {
return
}
*f = FieldName(data)
return
}
// UnmarshalText populates a FieldName from plaintext.
func (f *FieldName) UnmarshalText(data []byte) (err error) {
if data == nil || len(data) == 0 {
return
}
*f = FieldName(data)
return
}
// Size returns the FieldName's calculated size (in bytes).
func (f *FieldName) Size() (size int) {
if f == nil {
return
}
size = len(*f)
return
}
// String returns a string representation of a FieldName.
func (f *FieldName) String() (s string) {
if f == nil {
return
}
s = string([]byte(*f))
return
}