当前位置: 首页>>代码示例>>Golang>>正文


Golang Marshaller.MarshalUint32方法代码示例

本文整理汇总了Golang中github.com/calmh/xdr.Marshaller.MarshalUint32方法的典型用法代码示例。如果您正苦于以下问题:Golang Marshaller.MarshalUint32方法的具体用法?Golang Marshaller.MarshalUint32怎么用?Golang Marshaller.MarshalUint32使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/calmh/xdr.Marshaller的用法示例。


在下文中一共展示了Marshaller.MarshalUint32方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: MarshalXDRInto

func (o ClusterConfigMessage) MarshalXDRInto(m *xdr.Marshaller) error {
	if l := len(o.DeviceName); l > 64 {
		return xdr.ElementSizeExceeded("DeviceName", l, 64)
	}
	m.MarshalString(o.DeviceName)
	if l := len(o.ClientName); l > 64 {
		return xdr.ElementSizeExceeded("ClientName", l, 64)
	}
	m.MarshalString(o.ClientName)
	if l := len(o.ClientVersion); l > 64 {
		return xdr.ElementSizeExceeded("ClientVersion", l, 64)
	}
	m.MarshalString(o.ClientVersion)
	if l := len(o.Folders); l > 1000000 {
		return xdr.ElementSizeExceeded("Folders", l, 1000000)
	}
	m.MarshalUint32(uint32(len(o.Folders)))
	for i := range o.Folders {
		if err := o.Folders[i].MarshalXDRInto(m); err != nil {
			return err
		}
	}
	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
}
开发者ID:hernad,项目名称:syncthing,代码行数:33,代码来源:message_xdr.go

示例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.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
}
开发者ID:tcrutt,项目名称:syncthing,代码行数:25,代码来源:localpackets_xdr.go

示例3: MarshalXDRInto

func (o CloseMessage) MarshalXDRInto(m *xdr.Marshaller) error {
	if l := len(o.Reason); l > 1024 {
		return xdr.ElementSizeExceeded("Reason", l, 1024)
	}
	m.MarshalString(o.Reason)
	m.MarshalUint32(uint32(o.Code))
	return m.Error
}
开发者ID:carriercomm,项目名称:syncthing,代码行数:8,代码来源:message_xdr.go

示例4: MarshalXDRInto

func (v Vector) MarshalXDRInto(m *xdr.Marshaller) error {
	m.MarshalUint32(uint32(len(v)))
	for i := range v {
		m.MarshalUint64(uint64(v[i].ID))
		m.MarshalUint64(v[i].Value)
	}
	return m.Error
}
开发者ID:tcrutt,项目名称:syncthing,代码行数:8,代码来源:vector_xdr.go

示例5: MarshalXDRInto

func (o XDRA) MarshalXDRInto(m *xdr.Marshaller) error {
	m.MarshalString(o.Name)
	m.MarshalUint64(uint64(o.BirthDay))
	m.MarshalString(o.Phone)
	m.MarshalUint32(uint32(o.Siblings))
	m.MarshalBool(o.Spouse)
	m.MarshalUint64(o.Money)
	return m.Error
}
开发者ID:alecthomas,项目名称:go_serialization_benchmarks,代码行数:9,代码来源:structdefxdr_generated.go

示例6: MarshalXDRInto

func (o VersionList) MarshalXDRInto(m *xdr.Marshaller) error {
	m.MarshalUint32(uint32(len(o.versions)))
	for i := range o.versions {
		if err := o.versions[i].MarshalXDRInto(m); err != nil {
			return err
		}
	}
	return m.Error
}
开发者ID:carriercomm,项目名称:syncthing,代码行数:9,代码来源:leveldb_xdr.go

示例7: 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
}
开发者ID:letiemble,项目名称:syncthing,代码行数:43,代码来源:encdec_xdr_test.go

示例8: 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
}
开发者ID:letiemble,项目名称:syncthing,代码行数:21,代码来源:bench_xdr_test.go

示例9: MarshalXDRInto

func (h header) MarshalXDRInto(m *xdr.Marshaller) error {
	v := encodeHeader(h)
	m.MarshalUint32(v)
	return m.Error
}
开发者ID:tcrutt,项目名称:syncthing,代码行数:5,代码来源:header.go

示例10: MarshalXDRInto

func (o Response) MarshalXDRInto(m *xdr.Marshaller) error {
	m.MarshalUint32(uint32(o.Code))
	m.MarshalString(o.Message)
	return m.Error
}
开发者ID:letiemble,项目名称:syncthing,代码行数:5,代码来源:packets_xdr.go


注:本文中的github.com/calmh/xdr.Marshaller.MarshalUint32方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。