Lines Matching refs:value
6477 ($value:ident => $($ty:ty),+) => {$(
6478 let borrowed = <$ty>::from(Cow::Borrowed($value));
6479 let owned = <$ty>::from(Cow::Owned($value.to_owned()));
6480 assert_eq!($value, &*borrowed);
6481 assert_eq!($value, &*owned);
6483 ($value:ident : & $ty:ty) => {
6484 test_from_cow!($value => Box<$ty>, Rc<$ty>, Arc<$ty>);
8757 value: bool,
8763 self.value == other.value
8776 Panic { drop_counter: &DROP_COUNTER, value: false, index: 0 },
8777 Panic { drop_counter: &DROP_COUNTER, value: false, index: 5 },
8778 Panic { drop_counter: &DROP_COUNTER, value: true, index: 6 },
8779 Panic { drop_counter: &DROP_COUNTER, value: true, index: 7 },
8782 Panic { drop_counter: &DROP_COUNTER, value: false, index: 0 },
8784 Panic { drop_counter: &DROP_COUNTER, value: false, index: 1 },
8785 Panic { drop_counter: &DROP_COUNTER, value: false, index: 2 },
8786 Panic { drop_counter: &DROP_COUNTER, value: false, index: 3 },
8787 Panic { drop_counter: &DROP_COUNTER, value: false, index: 4 },
8789 Panic { drop_counter: &DROP_COUNTER, value: false, index: 5 },
8790 Panic { drop_counter: &DROP_COUNTER, value: true, index: 6 },
8791 Panic { drop_counter: &DROP_COUNTER, value: true, index: 7 },
11105 // Matching arrays by value:
13277 assert_eq!(format!("{:?}", refcell), "RefCell { value: 5 }");
13279 assert_eq!(format!("{:?}", refcell), "RefCell { value: <borrowed> }");
13281 assert_eq!(format!("{:?}", refcell), "RefCell { value: 5 }");
13903 /// to the same boxed integer value, not five references pointing to independently
13907 /// This will still evaluate `expr`, however, and immediately drop the resulting value, so
13960 /// To convert a single value to a string, use the [`to_string`] method. This
14411 // the cloned value in-place, skipping the local and move.
14419 // We can always copy in-place, without ever involving a local value.
15479 /// To uppercase the value in-place, use [`make_ascii_uppercase`].
15509 /// To lowercase the value in-place, use [`make_ascii_lowercase`].
16454 /// A possible error value when converting a `String` from a UTF-8 byte vector.
16482 /// let value = String::from_utf8(bytes);
16484 /// assert!(value.is_err());
16485 /// assert_eq!(vec![0, 159], value.unwrap_err().into_bytes());
16494 /// A possible error value when converting a `String` from a UTF-16 byte slice.
16847 /// * `capacity` needs to be the correct value.
17209 /// and the supplied value.
17847 /// let value = String::from_utf8(bytes);
17849 /// assert_eq!(&[0, 159], value.unwrap_err().as_bytes());
17870 /// let value = String::from_utf8(bytes);
17872 /// assert_eq!(vec![0, 159], value.unwrap_err().into_bytes());
18224 /// Concatenating two `String`s takes the first by value and borrows the second:
18404 /// A trait for converting a value to a `String`.
18415 /// Converts the given value to a `String`.
18920 /// value, cloning if necessary.
18977 /// _ => panic!("expect borrowed value"),
18981 /// // Mutates the data from slice into owned vec and pushes a new value on top
19223 /// Creates an owned Cow<'a, B> with the default value for the contained owned value.
19316 //! This type can be sent among threads efficiently as the size of a `Box` value
19499 //! The type [`Rc<T>`][`Rc`] provides shared ownership of a value of type `T`,
19502 //! given allocation is destroyed, the value stored in that allocation (often
19503 //! referred to as "inner value") is also dropped.
19520 //! to an [`Rc`], but this will return [`None`] if the value stored in the allocation has
19521 //! already been dropped. In other words, `Weak` pointers do not keep the value
19523 //! (the backing store for the inner value) alive.
19531 //! so you can call `T`'s methods on a value of type [`Rc<T>`][`Rc`]. To avoid name
19556 //! [`Weak<T>`][`Weak`] does not auto-dereference to `T`, because the inner value may have
19648 //! memory safety by only giving out shared references to the value it wraps,
19650 //! value we wish to mutate in a [`RefCell`], which provides *interior
19778 value: T,
19787 /// that you have to call them as e.g., [`Rc::get_mut(&mut value)`][get_mut] instead of
19788 /// `value.get_mut()`. This avoids conflicts with methods of the inner type `T`.
19837 pub fn new(value: T) -> Rc<T> {
19843 Box::leak(box RcBox { strong: Cell::new(1), weak: Cell::new(1), value }).into(),
19849 /// in a `None` value. However, the weak reference may be cloned freely and
19878 value: mem::MaybeUninit::<T>::uninit(),
19896 ptr::write(ptr::addr_of_mut!((*inner).value), data);
19986 pub fn try_new(value: T) -> Result<Rc<T>, AllocError> {
19992 Box::leak(Box::try_new(RcBox { strong: Cell::new(1), weak: Cell::new(1), value })?)
20064 /// `value` will be pinned in memory and unable to be moved.
20066 pub fn pin(value: T) -> Pin<Rc<T>> {
20067 unsafe { Pin::new_unchecked(Rc::new(value)) }
20070 /// Returns the inner value, if the `Rc` has exactly one strong reference.
20181 /// it is up to the caller to guarantee that the inner value
20220 /// it is up to the caller to guarantee that the inner value
20302 unsafe { ptr::addr_of_mut!((*ptr).value) }
20315 /// The user of `from_raw` has to make sure a specific value of `T` is only
20486 /// mutate a shared value.
20489 /// the inner value when there are other pointers.
20544 unsafe { &mut (*this.ptr.as_ptr()).value }
20575 /// [`clone`] the inner value to a new allocation to ensure unique ownership. This is also
20625 // Pre-allocate memory to allow writing the cloned value directly.
20651 unsafe { &mut this.ptr.as_mut().value }
20666 /// fn print_if_string(value: Rc<dyn Any>) {
20667 /// if let Ok(string) = value.downcast::<String>() {
20689 /// a possibly-unsized inner value where the value has the layout provided.
20698 // Calculate layout using the given value layout.
20710 /// a possibly-unsized inner value where the value has the layout provided,
20721 // Calculate layout using the given value layout.
20742 /// Allocates an `RcBox<T>` with sufficient space for an unsized inner value
20744 // Allocate for the `RcBox<T>` using the given value.
20762 // Copy value as bytes
20765 &mut (*ptr).value as *mut _ as *mut u8,
20795 ptr::copy_nonoverlapping(v.as_ptr(), &mut (*ptr).value as *mut [T] as *mut T, v.len());
20832 let elems = &mut (*ptr).value as *mut [T] as *mut T;
20874 &self.inner().value
20887 /// [`Weak`], so we `drop` the inner value.
20952 /// Creates a new `Rc<T>`, with the `Default` value for `T`.
20997 /// the same value, than two `&T`s.
21427 /// prevent the value stored in the allocation from being dropped, and `Weak` itself makes no
21428 /// guarantees about the value still being present. Thus it may return [`None`]
21433 /// managed by [`Rc`] without preventing its inner value from being dropped. It is also used to
21447 // to allocate space on the heap. That's not a value a real pointer
21466 /// Calling [`upgrade`] on the return value always gives [`None`].
21534 unsafe { ptr::addr_of_mut!((*ptr).value) }
21635 /// dropping of the inner value if successful.
21637 /// Returns [`None`] if the inner value has since been dropped.
21829 /// Calling [`upgrade`] on the return value always gives [`None`].
21870 // We want to abort on overflow instead of dropping the value.
21894 // We want to abort on overflow instead of dropping the value.
21958 // Align the unsized value to the end of the RcBox.
22550 /// Flattens a slice of `T` into a single value `Self::Output`.
22566 /// Flattens a slice of `T` into a single value `Self::Output`, placing a
22584 /// Flattens a slice of `T` into a single value `Self::Output`, placing a
22613 /// To uppercase the value in-place, use [`make_ascii_uppercase`].
22630 /// To lowercase the value in-place, use [`make_ascii_lowercase`].
23249 // Wake by value, moving the Arc into the Wake::wake function
23333 /// The type `Arc<T>` provides shared ownership of a value of type `T`,
23337 /// pointer to a given allocation is destroyed, the value stored in that allocation (often
23338 /// referred to as "inner value") is also dropped.
23375 /// to an `Arc`, but this will return [`None`] if the value stored in the allocation has
23376 /// already been dropped. In other words, `Weak` pointers do not keep the value
23378 /// (the backing store for the value) alive.
23402 /// so you can call `T`'s methods on a value of type `Arc<T>`. To avoid name
23427 /// [`Weak<T>`][Weak] does not auto-dereference to `T`, because the inner value may have
23526 /// prevent the value stored in the allocation from being dropped, and `Weak` itself makes no
23527 /// guarantees about the value still being present. Thus it may return [`None`]
23532 /// managed by [`Arc`] without preventing its inner value from being dropped. It is also used to
23546 // to allocate space on the heap. That's not a value a real pointer
23576 // the value usize::MAX acts as a sentinel for temporarily "locking" the
23612 /// in a `None` value. However, the weak reference may be cloned freely and
23653 // Now we can properly initialize the inner value and turn our weak
23844 /// Returns the inner value, if the `Arc` has exactly one strong reference.
23954 /// it is up to the caller to guarantee that the inner value
23993 /// it is up to the caller to guarantee that the inner value
24086 /// The user of `from_raw` has to make sure a specific value of `T` is only
24138 // This Relaxed is OK because we're checking the value in the CAS
24192 // If the weak count is currently locked, the value of the
24341 /// a possibly-unsized inner value where the value has the layout provided.
24350 // Calculate layout using the given value layout.
24362 /// a possibly-unsized inner value where the value has the layout provided,
24372 // Calculate layout using the given value layout.
24392 /// Allocates an `ArcInner<T>` with sufficient space for an unsized inner value.
24394 // Allocate for the `ArcInner<T>` using the given value.
24412 // Copy value as bytes
24585 /// then `make_mut` will create a new allocation and invoke [`clone`][clone] on the inner value
24627 // Pre-allocate memory to allow writing the cloned value directly.
24675 /// mutate a shared value.
24678 /// the inner value when there are other pointers.
24780 /// [`Weak`], so we `drop` the inner value.
24857 /// fn print_if_string(value: Arc<dyn Any + Send + Sync>) {
24858 /// if let Ok(string) = value.downcast::<String>() {
24883 /// Calling [`upgrade`] on the return value always gives [`None`].
25049 /// dropping of the inner value if successful.
25051 /// Returns [`None`] if the inner value has since been dropped.
25080 // "stale" read of 0 is fine), and any other value is
25096 // value can be initialized after `Weak` references have already been created. In that case, we
25097 // expect to observe the fully initialized value.
25121 /// Due to implementation details, the returned value can be off by 1 in
25247 /// Calling [`upgrade`] on the return value always
25331 /// the same value, than two `&T`s.
25376 /// two `Arc`s that point to the same value are never unequal.
25527 /// Creates a new `Arc<T>`, with the `Default` value for `T`.
25787 // Align the unsized value to the end of the ArcInner.
25819 //! format!("{value}", value=4); // => "4"
25834 //! To convert a single value to a string, use the [`to_string`] method. This
25839 //! Each formatting argument is allowed to specify which value argument it's
25904 //! If the value's string does not fill up this many characters, then the
25908 //! The value for the width can also be provided as a [`usize`] in the list of
25927 //! This indicates that if the value being formatted is smaller than
25988 //! value is emitted with proper `fill`, `alignment` and `width` if those parameters are set.
26008 //! first input holds the `usize` precision, and the second holds the value to print. Note that
26010 //! to the *value* to print, and the `precision` must come in the input preceding `<arg>`.
26065 //! println!("The value is {}", 1.5);
26150 //! Additionally, the return value of this function is [`fmt::Result`] which is a
26175 //! // The `f` value implements the `Write` trait, which is what the
26298 //! The result of the [`format_args!`] macro is a value of type [`fmt::Arguments`].
27575 /// given value.
28585 /// Consumes the list into an iterator yielding elements by value.
29192 /// Appends all key-value pairs from the union of two ascending iterators,
29215 /// Pushes all key-value pairs to the end of the tree, incrementing a
29223 // Iterate through all key-value pairs, pushing them into nodes at the right level.
29224 for (key, value) in iter {
29225 // Try to push key-value pair into the current leaf node.
29227 cur_node.push(key, value);
29253 // Push key-value pair and new right subtree.
29259 open_node.push(key, value, right_tree);
29282 /// If two keys are equal, returns the key-value pair from the right source.
29895 /// // Look up the value for a key (will panic if the key is not found).
29917 /// // could actually return some random value here - let's just return
29918 /// // some fixed value for now
29925 /// // insert a key using a function that provides a new value only if it
30308 /// Returns a reference to the value corresponding to the key.
30338 /// Returns the key-value pair corresponding to the supplied key.
30366 /// Returns the first key-value pair in the map.
30450 /// Returns the last key-value pair in the map.
30533 /// Returns `true` if the map contains a value for the specified key.
30559 /// Returns a mutable reference to the value corresponding to the key.
30592 /// Inserts a key-value pair into the map.
30596 /// If the map did have this key present, the value is updated, and the old
30597 /// value is returned. The key is not updated, though; this matters for
30619 pub fn insert(&mut self, key: K, value: V) -> Option<V>
30624 Occupied(mut entry) => Some(entry.insert(value)),
30626 entry.insert(value);
30632 /// Tries to insert a key-value pair into the map, and returns
30633 /// a mutable reference to the value in the entry.
30636 /// an error containing the occupied entry and the value is returned.
30653 /// assert_eq!(err.value, "b");
30656 pub fn try_insert(&mut self, key: K, value: V) -> Result<&mut V, OccupiedError<'_, K, V>>
30661 Occupied(entry) => Err(OccupiedError { entry, value }),
30662 Vacant(entry) => Ok(entry.insert(value)),
30666 /// Removes a key from the map, returning the value at the key if the key
30694 /// Removes a key from the map, returning the stored key and value if the key
30826 /// for (&key, &value) in map.range((Included(&4), Included(&8))) {
30827 /// println!("{}: {}", key, value);
30972 /// Creates an iterator that visits all elements (key-value pairs) in
30978 /// The iterator also lets you mutate the value of each element in the
30983 /// change its value and, by returning `true`, have the element removed and
30988 /// dropping an element, or if the `DrainFilter` value is leaked.
31746 self.extend(iter.into_iter().map(|(&key, &value)| (key, value)));
31813 /// Returns a reference to the value corresponding to the supplied key.
31839 /// for (key, value) in map.iter() {
31840 /// println!("{}: {}", key, value);
31871 /// // add 10 to the value if the key isn't "a"
31872 /// for (key, value) in map.iter_mut() {
31874 /// *value += 10;
31950 /// for value in a.values_mut() {
31951 /// value.push_str("!");
32064 /// This replaces the value behind the `v` unique reference by calling the
32071 replace(v, |value| (change(value), ()))
32074 /// This replaces the value behind the `v` unique reference by calling the
32087 let value = unsafe { ptr::read(v) };
32088 let (new_value, ret) = change(value);
32101 /// a given number of distinct key-value pairs.
32120 /// Split off a tree with key-value pairs at and after the given key.
32358 Answer(Option<&'a T>), // return a specific value or emptiness
32631 /// Returns `true` if the set contains a value.
32633 /// The value may be any borrowed form of the set's value type,
32635 /// ordering on the value type.
32647 pub fn contains<Q: ?Sized>(&self, value: &Q) -> bool
32652 self.map.contains_key(value)
32655 /// Returns a reference to the value in the set, if any, that is equal to the given value.
32657 /// The value may be any borrowed form of the set's value type,
32659 /// ordering on the value type.
32671 pub fn get<Q: ?Sized>(&self, value: &Q) -> Option<&T>
32676 Recover::get(&self.map, value)
32808 /// Returns a reference to the first value in the set, if any.
32809 /// This value is always the minimum of all values in the set.
32834 /// Returns a reference to the last value in the set, if any.
32835 /// This value is always the maximum of all values in the set.
32860 /// Removes the first value from the set and returns it, if any.
32861 /// The first value is always the minimum value in the set.
32885 /// Removes the last value from the set and returns it, if any.
32886 /// The last value is always the maximum value in the set.
32910 /// Adds a value to the set.
32912 /// If the set did not have this value present, `true` is returned.
32914 /// If the set did have this value present, `false` is returned, and the
32931 pub fn insert(&mut self, value: T) -> bool
32935 self.map.insert(value, ()).is_none()
32938 /// Adds a value to the set, replacing the existing value, if any, that is equal to the given
32939 /// one. Returns the replaced value.
32954 pub fn replace(&mut self, value: T) -> Option<T>
32958 Recover::replace(&mut self.map, value)
32961 /// Removes a value from the set. Returns whether the value was
32964 /// The value may be any borrowed form of the set's value type,
32966 /// ordering on the value type.
32981 pub fn remove<Q: ?Sized>(&mut self, value: &Q) -> bool
32986 self.map.remove(value).is_some()
32989 /// Removes and returns the value in the set, if any, that is equal to the given one.
32991 /// The value may be any borrowed form of the set's value type,
32993 /// ordering on the value type.
33005 pub fn take<Q: ?Sized>(&mut self, value: &Q) -> Option<T>
33010 Recover::take(&mut self.map, value)
33110 /// Creates an iterator which uses a closure to determine if a value should be removed.
33112 /// If the closure returns true, then the value is removed and yielded.
33113 /// If the closure returns false, the value will remain in the list and will not be yielded
33120 /// if a panic occurs in the closure, or if a panic occurs while dropping a value, or if the
33897 // twice, and never end up with overlapping value references.
33988 /// on the right side, and the key-value pair in between, which is either
33992 /// implies that if no more key-value pair exists, the entire remainder of
34016 /// on the left side, and the key-value pair in between, which is either
34020 /// implies that if no more key-value pair exists, the entire remainder of
34059 /// key and value in between.
34072 /// key and value in between.
34087 /// key and value in between.
34102 /// key and value in between.
34118 /// Moves the leaf edge handle to the next leaf edge and returns the key and value
34136 /// Moves the leaf edge handle to the previous leaf edge and returns the key and value
35115 f.debug_struct("OccupiedEntry").field("key", self.key()).field("value", self.get()).finish()
35121 /// Contains the occupied entry, and the value that was not inserted.
35126 /// The value which was not inserted, because the entry was already occupied.
35127 pub value: V,
35136 .field("new_value", &self.value)
35146 "failed to insert {:?}, key {:?} already exists with value {:?}",
35147 self.value,
35155 /// Ensures a value is in the entry by inserting the default if empty, and returns
35156 /// a mutable reference to the value in the entry.
35176 /// Ensures a value is in the entry by inserting the result of the default function if empty,
35177 /// and returns a mutable reference to the value in the entry.
35199 /// Ensures a value is in the entry by inserting, if empty, the result of the default function.
35223 let value = default(entry.key());
35224 entry.insert(value)
35284 /// Ensures a value is in the entry by inserting the default value if empty,
35285 /// and returns a mutable reference to the value in the entry.
35306 /// Gets a reference to the key that would be used when inserting a value
35341 /// Sets the value of the entry with the `VacantEntry`'s key,
35358 pub fn insert(self, value: V) -> &'a mut V {
35359 let out_ptr = match self.handle.insert_recursing(self.key, value) {
35399 /// Take ownership of the key and value from the map.
35415 /// // If now try to get the value, it will panic:
35423 /// Gets a reference to the value in the entry.
35443 /// Gets a mutable reference to the value in the entry.
35446 /// destruction of the `Entry` value, see [`into_mut`].
35474 /// Converts the entry into a mutable reference to its value.
35500 /// Sets the value of the entry with the `OccupiedEntry`'s key,
35501 /// and returns the entry's old value.
35518 pub fn insert(&mut self, value: V) -> V {
35519 mem::replace(self.get_mut(), value)
35522 /// Takes the value of the entry out of the map, and returns it.
35536 /// // If we try to get "poneyland"'s value, it'll panic:
35696 // Tests our value of MIN_INSERTS_HEIGHT_2. Failure may mean you just need to
35697 // adapt that value to match a change in node::CAPACITY or the choices made
35829 // 1 key-value pair:
35849 // 2 key-value pairs:
35861 // 1 key-value pair:
35939 // Specifically tests iter_mut's ability to mutate the value of pairs in-line.
36023 for value in a.values_mut() {
36024 value.push_str("!");
37357 let value = "value goes here";
37359 a.insert(key, value);
37361 assert_eq!(a[key], value);
37368 assert_eq!(a[key], value);
37376 let value = "value goes here";
37383 e.insert(value);
37387 assert_eq!(a[key], value);
37737 /// Removes a key-value pair from the tree, and returns that pair, as well as
37871 /// being merged. If both returned options contain a value, that value
37873 /// contains a value, that value doesn't occur in the other source (or
37875 /// contains a value, iteration has finished and subsequent calls will
38067 /// although insert methods allow a mutable pointer to a value to coexist.
38095 /// - Take `self` by value, and return the lifetime carried by `BorrowType`.
38376 /// Borrows exclusive access to an element or slice of the node's value storage area.
38385 // until the value slice reference is dropped, as we have unique access
38515 /// because the return value cannot be used to destroy the root, and there
38534 /// Adds a key-value pair to the end of the node.
38548 /// Adds a key-value pair, and an edge to go to the right of that pair,
38618 /// A reference to a specific key-value pair or edge within a node. The `Node` parameter
38619 /// must be a `NodeRef`, while the `Type` can either be `KV` (signifying a handle on a key-value
38623 /// a child node, these represent the spaces where child pointers would go between the key-value
38642 /// Retrieves the node that contains the edge or key-value pair this handle points to.
38654 /// Creates a new handle to a key-value pair in `node`.
38737 /// The goal of the split point is for its key and value to end up in a parent node;
38752 /// Inserts a new key-value pair between the key-value pairs to the right and left of
38756 /// The returned pointer points to the inserted value.
38772 /// Inserts a new key-value pair between the key-value pairs to the right and left of
38775 /// The returned pointer points to the inserted value.
38812 /// Inserts a new key-value pair and an edge that will go to the right of that new pair
38813 /// between this edge and the key-value pair to the right of this edge. This method assumes
38830 /// Inserts a new key-value pair and an edge that will go to the right of that new pair
38831 /// between this edge and the key-value pair to the right of this edge. This method splits
38864 /// Inserts a new key-value pair between the key-value pairs to the right and left of
38870 /// The returned pointer points to the inserted value.
38874 value: V,
38876 let (mut split, val_ptr) = match self.insert(key, value) {
38913 // height field because that value is copied. Beware that, once the
38954 // We cannot call separate key and value methods, because calling the second one
38964 /// Replace the key and value that the KV handle refers to.
39001 /// - The node is truncated to only contain the key-value pairs to the left of
39003 /// - The key and value pointed to by this handle are extracted.
39004 /// - All the key-value pairs to the right of this handle are put into a newly
39015 /// Removes the key-value pair pointed to by this handle and returns it, along with the edge
39016 /// that the key-value pair collapsed into.
39033 /// - The node is truncated to only contain the edges and key-value pairs to the
39035 /// - The key and value pointed to by this handle are extracted.
39036 /// - All the edges and key-value pairs to the right of this handle are put into
39058 /// around an internal key-value pair.
39201 /// Merges the parent's key-value pair and both adjacent child nodes into
39209 /// Merges the parent's key-value pair and both adjacent child nodes into
39217 /// Merges the parent's key-value pair and both adjacent child nodes into
39240 /// Removes a key-value pair from the left child and places it in the key-value storage
39241 /// of the parent, while pushing the old parent key-value pair into the right child.
39252 /// Removes a key-value pair from the right child and places it in the key-value storage
39253 /// of the parent, while pushing the old parent key-value pair onto the left child.
39303 // Move parent's key-value pair to the right child.
39352 // Move parent's key-value pair to the left child.
39508 // Some key and value split off, to be inserted elsewhere.
39564 /// Inserts a value into a slice of initialized elements followed by one uninitialized element.
39580 /// Removes and returns a value from a slice of all initialized elements, leaving behind one
39966 Enable exposing the allocator’s custom error value \
40171 // Restore the original head value
40545 unsafe fn buffer_write(&mut self, off: usize, value: T) {
40547 ptr::write(self.ptr().add(off), value);
41119 /// and the supplied value.
41239 // so no value is dropped twice if `drop_in_place` panics
41513 /// if the `Drain` value is not dropped, but the borrow it holds expires
41609 /// given value.
41786 pub fn push_front(&mut self, value: T) {
41794 self.buffer_write(tail, value);
41811 pub fn push_back(&mut self, value: T) {
41818 unsafe { self.buffer_write(head, value) }
41922 pub fn insert(&mut self, index: usize, value: T) {
42118 self.buffer_write(new_idx, value);
42757 /// If the value is found then [`Result::Ok`] is returned, containing the
42759 /// one of the matches could be returned. If the value is not found then
42817 /// If the value is found then [`Result::Ok`] is returned, containing the
42819 /// one of the matches could be returned. If the value is not found then
42869 /// If the value is found then [`Result::Ok`] is returned, containing the
42871 /// one of the matches could be returned. If the value is not found then
42961 /// either by removing excess elements from the back or by appending clones of `value`
42982 pub fn resize(&mut self, new_len: usize, value: T) {
42983 self.resize_with(new_len, || value.clone());
43115 /// value.
44093 // This particular implementation hashes value 24 in addition to bytes.
44102 fn hash_code(value: impl Hash) -> u64 {
44104 value.hash(&mut hasher);
44326 //! // nodes in the queue. It also uses `usize::MAX` as a sentinel value,
44384 //! // corresponding to a node value, has a list of outgoing edges.
44483 /// value instead of the greatest one.
44509 /// The value for `push` is an expected cost; the method documentation gives a
44573 /// Removes the peeked value from the heap and returns it.
44576 let value = this.heap.pop().unwrap();
44578 value
44648 /// Note: If the `PeekMut` value is leaked, the heap may be in an
44802 // Take out the value at `pos` and create a hole.
45228 /// and the supplied value.
45381 /// Hole represents a hole in a slice i.e., an index without valid value
45384 /// position with the value that was originally removed.
45757 /// Creates a consuming iterator, that is, one that moves each value out of
45986 // Make up a value of this ZST.
46039 // Make up a value of this ZST.
46500 /// Whether this value is zero
46971 /// It can also initialize each element of a `Vec<T>` with a given value.
47725 /// and the supplied value.
47833 // such that no value will be dropped twice in case `drop_in_place`
48130 // The spot to put the new value
48176 // copy it out, unsafely having a copy of the value on
48440 pub fn push(&mut self, value: T) {
48448 ptr::write(end, value);
48686 /// you'd rather [`Clone`] a given value, use [`Vec::resize`]. If you
48876 /// difference, with each additional slot filled with `value`.
48880 /// in order to be able to clone the passed value.
48896 pub fn resize(&mut self, new_len: usize, value: T) {
48900 self.extend_with(new_len - len, ExtendElement(value))
49000 fn extend_with<E: ExtendWith<T>>(&mut self, n: usize, mut value: E) {
49012 ptr::write(ptr, value.next());
49020 ptr::write(ptr, value.last());
49221 /// Creates a consuming iterator, that is, one that moves each value out of
49328 /// if the `Splice` value is leaked.
49330 /// The input iterator `replace_with` is only consumed when the `Splice` value is dropped.
49706 // Set the length of the vec when the `SetLenOnDrop` value goes out of scope.
50180 //! Move a value from the stack to the heap by creating a [`Box`]:
50187 //! Move a value from a [`Box`] back to the stack by [dereferencing]:
50229 //! a `value: *mut T` that has been allocated with the [`Global`] allocator
50230 //! with `Layout::for_value(&*value)` may be converted into a box using
50231 //! [`Box::<T>::from_raw(value)`]. Conversely, the memory backing a `value: *mut
50233 //! [`Global`] allocator with [`Layout::for_value(&*value)`].
50249 //! value:
50284 //! free the value with the global allocator. In general, the best practice
50297 //! [`Box::<T>::from_raw(value)`]: Box::from_raw
50300 //! [`Layout::for_value(&*value)`]: crate::alloc::Layout::for_value
50681 /// Consumes the `Box`, returning the wrapped value.
50811 /// it is up to the caller to guarantee that the value
51180 /// Creates a `Box<T>`, with the `Default` value for T.
51210 /// // The value is the same
51218 // Pre-allocate memory to allow writing the cloned value directly.
51237 /// // The value is the same
51516 /// fn print_if_string(value: Box<dyn Any>) {
51517 /// if let Ok(string) = value.downcast::<String>() {
51548 /// fn print_if_string(value: Box<dyn Any + Send>) {
51549 /// if let Ok(string) = value.downcast::<String>() {
51580 /// fn print_if_string(value: Box<dyn Any + Send + Sync>) {
51581 /// if let Ok(string) = value.downcast::<String>() {
52031 fn set(&mut self, value: u32);
52041 fn set(&mut self, value: u32) {
52042 self.0 = value;