Lines Matching defs:borrow
3367 assert_eq!(*x.0.borrow(), 4);
3384 assert_eq!(*x.0.borrow(), 0);
3494 use std::borrow::Cow;
3658 use core::{borrow::Borrow, cell::Cell};
3671 fn borrow(&self) -> &str {
5615 use std::borrow::Cow;
6470 use std::borrow::{Cow, ToOwned};
6530 use std::borrow::Cow;
8875 mod borrow;
8910 use std::borrow::Cow;
8930 panic!("Adding empty strings to a borrow should note allocate");
8933 panic!("Adding empty strings to a borrow should note allocate");
8936 panic!("Adding empty strings to a borrow should note allocate");
8939 panic!("Adding empty strings to a borrow should note allocate");
8956 panic!("Adding empty strings to a borrow should note allocate");
8959 panic!("Adding empty strings to a borrow should note allocate");
8962 panic!("Adding empty strings to a borrow should note allocate");
8980 panic!("Adding empty strings to a borrow should note allocate");
8986 panic!("Adding empty strings to a borrow should note allocate");
8992 panic!("Adding empty strings to a borrow should note allocate");
8998 panic!("Adding empty strings to a borrow should note allocate");
9020 panic!("Adding empty strings to a borrow should note allocate");
9026 panic!("Adding empty strings to a borrow should note allocate");
9032 panic!("Adding empty strings to a borrow should note allocate");
9124 assert_eq!(*x.0.borrow(), 4);
9141 assert_eq!(*x.0.borrow(), 0);
13278 let borrow = refcell.borrow_mut();
13280 drop(borrow);
14999 use core::borrow::{Borrow, BorrowMut};
15006 use crate::borrow::ToOwned;
15076 let content_bytes = s.borrow().as_ref();
15085 let content_bytes = s.borrow().as_ref();
15110 // => s.borrow().as_ref() and we always have slices
15133 slice.iter().map(|s| s.borrow().as_ref().len()).try_fold(n, usize::checked_add)
15141 result.extend_from_slice(first.borrow().as_ref());
15152 // A weird borrow implementation may return different
15164 fn borrow(&self) -> &str {
16226 use crate::borrow::{Cow, ToOwned};
16685 /// [`Cow<'a, str>`]: crate::borrow::Cow
16784 /// [`Cow<'a, str>`]: crate::borrow::Cow
18596 /// # use std::borrow::Cow;
18614 /// # use std::borrow::Cow;
18634 /// # use std::borrow::Cow;
18825 pub use core::borrow::{Borrow, BorrowMut};
18838 fn borrow(&self) -> &B {
18848 /// from any borrow of a given type.
18875 /// This is borrow-generalized version of `Clone::clone_from`.
18930 /// use std::borrow::Cow;
18960 /// use std::borrow::Cow;
19011 let b: &B = o.borrow();
19019 (&mut Owned(ref mut dest), &Owned(ref o)) => o.borrow().clone_into(dest),
19032 /// use std::borrow::Cow;
19055 /// use std::borrow::Cow;
19076 /// use std::borrow::Cow;
19110 /// use std::borrow::Cow;
19124 /// use std::borrow::Cow;
19150 Owned(ref owned) => owned.borrow(),
19474 pub mod borrow;
19702 //! // `RefCell` dynamic borrow ends here.
19706 //! for gadget_weak in gadget_owner.gadgets.borrow().iter() {
19746 use core::borrow;
19764 use crate::borrow::{Cow, ToOwned};
20522 /// for the duration of the returned borrow.
21935 impl<T: ?Sized> borrow::Borrow<T> for Rc<T> {
21936 fn borrow(&self) -> &T {
22056 use core::borrow::{Borrow, BorrowMut};
22062 use crate::borrow::ToOwned;
22667 /// impl std::borrow::Borrow<[u32]> for Foo {
22668 /// fn borrow(&self) -> &[u32] { &self.0 }
22671 /// impl std::borrow::Borrow<[String]> for Foo {
22672 /// fn borrow(&self) -> &[String] { &self.1 }
22703 let size = slice.iter().map(|slice| slice.borrow().len()).sum();
22706 result.extend_from_slice(v.borrow())
22722 let size = slice.iter().map(|v| v.borrow().len()).sum::<usize>() + slice.len() - 1;
22724 result.extend_from_slice(first.borrow());
22728 result.extend_from_slice(v.borrow())
22745 slice.iter().map(|v| v.borrow().len()).sum::<usize>() + sep.len() * (slice.len() - 1);
22747 result.extend_from_slice(first.borrow());
22751 result.extend_from_slice(v.borrow())
22763 fn borrow(&self) -> &[T] {
23278 use core::borrow;
23298 use crate::borrow::{Cow, ToOwned};
24720 /// for the duration of the returned borrow.
25764 impl<T: ?Sized> borrow::Borrow<T> for Arc<T> {
25765 fn borrow(&self) -> &T {
26399 assert_eq!(*y.borrow(), 20);
27911 // avoid borrow issues.
29519 use core::borrow::Borrow;
29729 match key.cmp(k.borrow()) {
29793 use core::borrow::Borrow;
29803 use super::borrow::DormantMutRef;
32021 /// The borrow checker usually handles this stacking of borrows for you, but
32035 /// Capture a unique borrow, and immediately reborrow it. For the compiler,
32040 // SAFETY: we hold the borrow throughout 'a via `_marker`, and we expose
32046 /// Revert to the unique borrow initially captured.
32097 use core::borrow::Borrow;
32170 use core::borrow::Borrow;
33749 use core::borrow::Borrow;
33863 // SAFETY: our borrow type is immutable.
34264 mod borrow;
35050 use super::super::borrow::DormantMutRef;
35548 // SAFETY: we consumed the intermediate root borrow, `self.handle`.
36378 fn borrow(&self) -> &EvilTwin {
38023 /// through borrow type `Dying`, some of these pointers are dangling.
38061 /// - `BorrowType`: A dummy type that describes the kind of borrow and carries a lifetime.
38099 /// the borrow checker guarantees that the `NodeRef` remains borrowed as long
38338 /// bounds, or invalid under stacked borrow rules.
38372 // for the lifetime of the borrow.
38386 // for the lifetime of the borrow.
38402 // for the lifetime of the borrow.
38500 // SAFETY: we borrowed `self` exclusively and its borrow type is exclusive.
39545 // Whether node references of this borrow type allow traversing
41513 /// if the `Drain` value is not dropped, but the borrow it holds expires
46877 use crate::borrow::{Cow, ToOwned};
48556 // Use the borrow in the IterMut to indicate borrowing behavior of the
49595 /// # use std::borrow::Cow;
49877 use crate::borrow::Cow;
49913 use crate::borrow::Cow;
50134 pub use crate::borrow::ToOwned;
50306 use core::borrow;
50324 use crate::borrow::Cow;
51764 impl<T: ?Sized, A: Allocator> borrow::Borrow<T> for Box<T, A> {
51765 fn borrow(&self) -> &T {
51771 impl<T: ?Sized, A: Allocator> borrow::BorrowMut<T> for Box<T, A> {