本文整理汇总了Golang中github.com/calmh/xdr.Marshaller.MarshalBytes方法的典型用法代码示例。如果您正苦于以下问题:Golang Marshaller.MarshalBytes方法的具体用法?Golang Marshaller.MarshalBytes怎么用?Golang Marshaller.MarshalBytes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/calmh/xdr.Marshaller
的用法示例。
在下文中一共展示了Marshaller.MarshalBytes方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: MarshalXDRInto
func (o Device) MarshalXDRInto(m *xdr.Marshaller) error {
if l := len(o.ID); l > 32 {
return xdr.ElementSizeExceeded("ID", l, 32)
}
m.MarshalBytes(o.ID)
if l := len(o.Addresses); l > 16 {
return xdr.ElementSizeExceeded("Addresses", l, 16)
}
m.MarshalUint32(uint32(len(o.Addresses)))
for i := range o.Addresses {
if err := o.Addresses[i].MarshalXDRInto(m); err != nil {
return err
}
}
if l := len(o.Relays); l > 16 {
return xdr.ElementSizeExceeded("Relays", l, 16)
}
m.MarshalUint32(uint32(len(o.Relays)))
for i := range o.Relays {
if err := o.Relays[i].MarshalXDRInto(m); err != nil {
return err
}
}
return m.Error
}
示例2: MarshalXDRInto
func (o Device) MarshalXDRInto(m *xdr.Marshaller) error {
if l := len(o.ID); l > 32 {
return xdr.ElementSizeExceeded("ID", l, 32)
}
m.MarshalBytes(o.ID)
if l := len(o.Name); l > 64 {
return xdr.ElementSizeExceeded("Name", l, 64)
}
m.MarshalString(o.Name)
if l := len(o.Addresses); l > 64 {
return xdr.ElementSizeExceeded("Addresses", l, 64)
}
m.MarshalUint32(uint32(len(o.Addresses)))
for i := range o.Addresses {
m.MarshalString(o.Addresses[i])
}
m.MarshalUint32(o.Compression)
if l := len(o.CertName); l > 64 {
return xdr.ElementSizeExceeded("CertName", l, 64)
}
m.MarshalString(o.CertName)
m.MarshalUint64(uint64(o.MaxLocalVersion))
m.MarshalUint32(o.Flags)
if l := len(o.Options); l > 64 {
return xdr.ElementSizeExceeded("Options", l, 64)
}
m.MarshalUint32(uint32(len(o.Options)))
for i := range o.Options {
if err := o.Options[i].MarshalXDRInto(m); err != nil {
return err
}
}
return m.Error
}
示例3: MarshalXDRInto
func (o fileVersion) MarshalXDRInto(m *xdr.Marshaller) error {
if err := o.version.MarshalXDRInto(m); err != nil {
return err
}
m.MarshalBytes(o.device)
return m.Error
}
示例4: MarshalXDRInto
func (o ConnectRequest) MarshalXDRInto(m *xdr.Marshaller) error {
if l := len(o.ID); l > 32 {
return xdr.ElementSizeExceeded("ID", l, 32)
}
m.MarshalBytes(o.ID)
return m.Error
}
示例5: MarshalXDRInto
func (o TestStruct) MarshalXDRInto(m *xdr.Marshaller) error {
m.MarshalBool(o.B)
m.MarshalUint64(uint64(o.I))
m.MarshalUint8(uint8(o.I8))
m.MarshalUint8(o.UI8)
m.MarshalUint16(uint16(o.I16))
m.MarshalUint16(o.UI16)
m.MarshalUint32(uint32(o.I32))
m.MarshalUint32(o.UI32)
m.MarshalUint64(uint64(o.I64))
m.MarshalUint64(o.UI64)
if l := len(o.BS); l > 1024 {
return xdr.ElementSizeExceeded("BS", l, 1024)
}
m.MarshalBytes(o.BS)
if l := len(o.S); l > 1024 {
return xdr.ElementSizeExceeded("S", l, 1024)
}
m.MarshalString(o.S)
if err := o.C.MarshalXDRInto(m); err != nil {
return err
}
if l := len(o.SS); l > 1024 {
return xdr.ElementSizeExceeded("SS", l, 1024)
}
m.MarshalUint32(uint32(len(o.SS)))
for i := range o.SS {
m.MarshalString(o.SS[i])
}
if err := o.ES.MarshalXDRInto(m); err != nil {
return err
}
if err := o.OS.MarshalXDRInto(m); err != nil {
return err
}
m.MarshalUint32(uint32(len(o.OSs)))
for i := range o.OSs {
if err := o.OSs[i].MarshalXDRInto(m); err != nil {
return err
}
}
return m.Error
}
示例6: MarshalXDRInto
func (o XDRBenchStruct) MarshalXDRInto(m *xdr.Marshaller) error {
m.MarshalUint64(o.I1)
m.MarshalUint32(o.I2)
m.MarshalUint16(o.I3)
m.MarshalUint8(o.I4)
if l := len(o.Bs0); l > 128 {
return xdr.ElementSizeExceeded("Bs0", l, 128)
}
m.MarshalBytes(o.Bs0)
m.MarshalBytes(o.Bs1)
m.MarshalUint32(uint32(len(o.Is0)))
for i := range o.Is0 {
m.MarshalUint32(uint32(o.Is0[i]))
}
if l := len(o.S0); l > 128 {
return xdr.ElementSizeExceeded("S0", l, 128)
}
m.MarshalString(o.S0)
m.MarshalString(o.S1)
return m.Error
}