Closed MarijnS95 closed 7 months ago
The doc comments on buffer
and str
seem a little redundant because the rules are enforced by the type system anyway. The str
comment is also not strictly accurate because the string is only invalidated when you re-fetch the same key.^1 Not suggesting we should add document this implementation detail, but I don't think the adapted NDK docs are adding much value.
Looks good otherwise.
Fair enough for buffer
, I mostly copied the NDK docs for the few (two) functions that actually have docs upstream.
I'd like to keep "something" for fn str()
however, to justify to documentation readers why a getter is borrowing self
mutably.
Yes that makes sense. A mut
getter does look a bit odd on the face of it.
Fixes #451, CC @zarik5
All setters can inherently change the internals of the format, and should furthermore invalidate - or not be allowed while - borrowed strings or buffers (are) acquired from it.
Unforatunately
getString()
is documented as:Meaning that it is not reentrant, and invalidates any data previously acquired from
str()
; hence this getter is marked as&mut self
too. The same is however not the case forgetBuffer()
.