@@ -212,43 +212,51 @@ impl<B: ?Sized + ToOwned> Clone for Cow<'_, B> {
212212impl < B : ?Sized + ToOwned > Cow < ' _ , B > {
213213 /// Returns true if the data is borrowed, i.e. if `to_mut` would require additional work.
214214 ///
215+ /// Note: this is an associated function, which means that you have to call
216+ /// it as `Cow::is_borrowed(&c)` instead of `c.is_borrowed()`. This is so
217+ /// that there is no conflict with a method on the inner type.
218+ ///
215219 /// # Examples
216220 ///
217221 /// ```
218222 /// #![feature(cow_is_borrowed)]
219223 /// use std::borrow::Cow;
220224 ///
221225 /// let cow = Cow::Borrowed("moo");
222- /// assert!(cow. is_borrowed());
226+ /// assert!(Cow:: is_borrowed(&cow ));
223227 ///
224228 /// let bull: Cow<'_, str> = Cow::Owned("...moo?".to_string());
225- /// assert!(!bull. is_borrowed());
229+ /// assert!(!Cow:: is_borrowed(&bull ));
226230 /// ```
227231 #[ unstable( feature = "cow_is_borrowed" , issue = "65143" ) ]
228- pub const fn is_borrowed ( & self ) -> bool {
229- match * self {
232+ pub const fn is_borrowed ( c : & Self ) -> bool {
233+ match * c {
230234 Borrowed ( _) => true ,
231235 Owned ( _) => false ,
232236 }
233237 }
234238
235239 /// Returns true if the data is owned, i.e. if `to_mut` would be a no-op.
236240 ///
241+ /// Note: this is an associated function, which means that you have to call
242+ /// it as `Cow::is_owned(&c)` instead of `c.is_owned()`. This is so that
243+ /// there is no conflict with a method on the inner type.
244+ ///
237245 /// # Examples
238246 ///
239247 /// ```
240248 /// #![feature(cow_is_borrowed)]
241249 /// use std::borrow::Cow;
242250 ///
243251 /// let cow: Cow<'_, str> = Cow::Owned("moo".to_string());
244- /// assert!(cow. is_owned());
252+ /// assert!(Cow:: is_owned(&cow ));
245253 ///
246254 /// let bull = Cow::Borrowed("...moo?");
247- /// assert!(!bull. is_owned());
255+ /// assert!(!Cow:: is_owned(&bull ));
248256 /// ```
249257 #[ unstable( feature = "cow_is_borrowed" , issue = "65143" ) ]
250- pub const fn is_owned ( & self ) -> bool {
251- !self . is_borrowed ( )
258+ pub const fn is_owned ( c : & Self ) -> bool {
259+ !Cow :: is_borrowed ( c )
252260 }
253261
254262 /// Acquires a mutable reference to the owned form of the data.
0 commit comments