File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -214,17 +214,21 @@ impl Bytes {
214
214
///
215
215
/// Always returns false if the data is backed by a static slice.
216
216
///
217
+ /// The result of this method may be invalidated immediately if another
218
+ /// thread clones this value while this is being called. Ensure you have
219
+ /// unique access to this value (`&mut Bytes`) first if you need to be
220
+ /// certain the result is valid (i.e. for safety reasons)
217
221
/// # Examples
218
222
///
219
223
/// ```
220
224
/// use bytes::Bytes;
221
225
///
222
- /// let mut a = Bytes::from(vec![1, 2, 3]);
226
+ /// let a = Bytes::from(vec![1, 2, 3]);
223
227
/// assert!(a.is_unique());
224
228
/// let b = a.clone();
225
229
/// assert!(!a.is_unique());
226
230
/// ```
227
- pub fn is_unique ( & mut self ) -> bool {
231
+ pub fn is_unique ( & self ) -> bool {
228
232
unsafe { ( self . vtable . is_unique ) ( & self . data ) }
229
233
}
230
234
You can’t perform that action at this time.
0 commit comments