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
go-cid
Commits
628a0123
Commit
628a0123
authored
May 02, 2020
by
Eric Myhre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Slightly more documentation comment.
parent
266e76d5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
cid.go
cid.go
+9
-2
No files found.
cid.go
View file @
628a0123
...
...
@@ -409,12 +409,19 @@ func (c Cid) Bytes() []byte {
return
[]
byte
(
c
.
str
)
}
// ByteLen returns len(c.Bytes()) without an allocation
// ByteLen returns the length of the CID in bytes.
// It's equivalent to `len(c.Bytes())`, but works without an allocation,
// and should therefore be preferred.
//
// (See also the WriteTo method for other important operations that work without allocation.)
func
(
c
Cid
)
ByteLen
()
int
{
return
len
(
c
.
str
)
}
// WriteTo writes the cids bytes to the given writer
// WriteTo writes the CID bytes to the given writer.
// This method works without incurring any allocation.
//
// (See also the ByteLen method for other important operations that work without allocation.)
func
(
c
Cid
)
WriteTo
(
w
io
.
Writer
)
(
int
,
error
)
{
return
io
.
WriteString
(
w
,
c
.
str
)
}
...
...
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