Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
cbor-gen
Commits
be142a5a
Unverified
Commit
be142a5a
authored
Jul 13, 2021
by
Whyrusleeping
Committed by
GitHub
Jul 13, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #55 from whyrusleeping/feat/non-pointer-enc
feat: take cbor adapters by-value when encoding
parents
ad5b8262
d660ae24
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
cbor_cid.go
cbor_cid.go
+2
-2
utils.go
utils.go
+5
-5
No files found.
cbor_cid.go
View file @
be142a5a
...
...
@@ -8,8 +8,8 @@ import (
type
CborCid
cid
.
Cid
func
(
c
*
CborCid
)
MarshalCBOR
(
w
io
.
Writer
)
error
{
return
WriteCid
(
w
,
cid
.
Cid
(
*
c
))
func
(
c
CborCid
)
MarshalCBOR
(
w
io
.
Writer
)
error
{
return
WriteCid
(
w
,
cid
.
Cid
(
c
))
}
func
(
c
*
CborCid
)
UnmarshalCBOR
(
r
io
.
Reader
)
error
{
...
...
utils.go
View file @
be142a5a
...
...
@@ -626,8 +626,8 @@ func WriteCidBuf(buf []byte, w io.Writer, c cid.Cid) error {
type
CborBool
bool
func
(
cb
*
CborBool
)
MarshalCBOR
(
w
io
.
Writer
)
error
{
return
WriteBool
(
w
,
bool
(
*
cb
))
func
(
cb
CborBool
)
MarshalCBOR
(
w
io
.
Writer
)
error
{
return
WriteBool
(
w
,
bool
(
cb
))
}
func
(
cb
*
CborBool
)
UnmarshalCBOR
(
r
io
.
Reader
)
error
{
...
...
@@ -653,8 +653,8 @@ func (cb *CborBool) UnmarshalCBOR(r io.Reader) error {
type
CborInt
int64
func
(
ci
*
CborInt
)
MarshalCBOR
(
w
io
.
Writer
)
error
{
v
:=
int64
(
*
ci
)
func
(
ci
CborInt
)
MarshalCBOR
(
w
io
.
Writer
)
error
{
v
:=
int64
(
ci
)
if
v
>=
0
{
if
err
:=
WriteMajorTypeHeader
(
w
,
MajUnsignedInt
,
uint64
(
v
));
err
!=
nil
{
return
err
...
...
@@ -695,7 +695,7 @@ func (ci *CborInt) UnmarshalCBOR(r io.Reader) error {
type
CborTime
time
.
Time
func
(
ct
*
CborTime
)
MarshalCBOR
(
w
io
.
Writer
)
error
{
func
(
ct
CborTime
)
MarshalCBOR
(
w
io
.
Writer
)
error
{
nsecs
:=
ct
.
Time
()
.
UnixNano
()
cbi
:=
CborInt
(
nsecs
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment