diff options
author | Erik Dubbelboer <erik@dubbelboer.com> | 2021-10-01 13:37:28 +0200 |
---|---|---|
committer | Erik Dubbelboer <erik@dubbelboer.com> | 2021-10-01 13:38:31 +0200 |
commit | ffab77a59d9ca1fe3add2f6501efd44a6669291b (patch) | |
tree | aaf7a9f715cd1f5f813f2efbae1479628a18e7bc /args.go | |
parent | Properly parse URI (diff) | |
download | fasthttp-ffab77a59d9ca1fe3add2f6501efd44a6669291b.tar.gz fasthttp-ffab77a59d9ca1fe3add2f6501efd44a6669291b.tar.bz2 fasthttp-ffab77a59d9ca1fe3add2f6501efd44a6669291b.zip |
Improve return value reusability documentation
Diffstat (limited to 'args.go')
-rw-r--r-- | args.go | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -110,7 +110,8 @@ func (a *Args) String() string { // QueryString returns query string for the args. // -// The returned value is valid until the next call to Args methods. +// The returned value is valid until the Args is reused or released (ReleaseArgs). +// Do not store references to the returned value. Make copies instead. func (a *Args) QueryString() []byte { a.buf = a.AppendBytes(a.buf[:0]) return a.buf @@ -241,14 +242,16 @@ func (a *Args) SetBytesKNoValue(key []byte) { // Peek returns query arg value for the given key. // -// Returned value is valid until the next Args call. +// The returned value is valid until the Args is reused or released (ReleaseArgs). +// Do not store references to the returned value. Make copies instead. func (a *Args) Peek(key string) []byte { return peekArgStr(a.args, key) } // PeekBytes returns query arg value for the given key. // -// Returned value is valid until the next Args call. +// The returned value is valid until the Args is reused or released (ReleaseArgs). +// Do not store references to the returned value. Make copies instead. func (a *Args) PeekBytes(key []byte) []byte { return peekArgBytes(a.args, key) } |