本文整理汇总了Golang中github.com/calmh/xdr.Marshaller类的典型用法代码示例。如果您正苦于以下问题:Golang Marshaller类的具体用法?Golang Marshaller怎么用?Golang Marshaller使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Marshaller类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: MarshalXDRInto
func (o Address) MarshalXDRInto(m *xdr.Marshaller) error {
if l := len(o.URL); l > 2083 {
return xdr.ElementSizeExceeded("URL", l, 2083)
}
m.MarshalString(o.URL)
return m.Error
}
开发者ID:tcrutt,项目名称:syncthing,代码行数:7,代码来源:localpackets_xdr.go
示例2: MarshalXDRInto
func (o JoinSessionRequest) MarshalXDRInto(m *xdr.Marshaller) error {
if l := len(o.Key); l > 32 {
return xdr.ElementSizeExceeded("Key", l, 32)
}
m.MarshalBytes(o.Key)
return m.Error
}
开发者ID:letiemble,项目名称:syncthing,代码行数:7,代码来源:packets_xdr.go
示例3: 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
示例4: 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
}
开发者ID:carriercomm,项目名称:syncthing,代码行数:7,代码来源:leveldb_xdr.go
示例5: MarshalXDRInto
func (o Folder) MarshalXDRInto(m *xdr.Marshaller) error {
if l := len(o.ID); l > 256 {
return xdr.ElementSizeExceeded("ID", l, 256)
}
m.MarshalString(o.ID)
if l := len(o.Label); l > 256 {
return xdr.ElementSizeExceeded("Label", l, 256)
}
m.MarshalString(o.Label)
if l := len(o.Devices); l > 1000000 {
return xdr.ElementSizeExceeded("Devices", l, 1000000)
}
m.MarshalUint32(uint32(len(o.Devices)))
for i := range o.Devices {
if err := o.Devices[i].MarshalXDRInto(m); err != nil {
return err
}
}
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
}
开发者ID:carriercomm,项目名称:syncthing,代码行数:30,代码来源:message_xdr.go
示例6: 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
}
}
return m.Error
}
开发者ID:carriercomm,项目名称:syncthing,代码行数:16,代码来源:localpackets_xdr.go
示例7: 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
示例8: MarshalXDRInto
func (o Version13HelloMessage) 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)
return m.Error
}
开发者ID:letiemble,项目名称:syncthing,代码行数:15,代码来源:hello_v0.13_xdr.go
示例9: MarshalXDRInto
func (o OtherStruct) MarshalXDRInto(m *xdr.Marshaller) error {
m.MarshalUint32(o.F1)
m.MarshalString(o.F2)
return m.Error
}
开发者ID:letiemble,项目名称:syncthing,代码行数:5,代码来源:encdec_xdr_test.go
示例10: 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
示例11: MarshalXDRInto
func (h header) MarshalXDRInto(m *xdr.Marshaller) error {
v := encodeHeader(h)
m.MarshalUint32(v)
return m.Error
}
开发者ID:tcrutt,项目名称:syncthing,代码行数:5,代码来源:header.go
示例12: MarshalXDRInto
func (u *Opaque) MarshalXDRInto(m *xdr.Marshaller) error {
m.MarshalRaw(u[:])
return m.Error
}
开发者ID:letiemble,项目名称:syncthing,代码行数:4,代码来源:encdec_test.go
示例13: 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
注:本文中的github.com/calmh/xdr.Marshaller类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论