Fix documentation of Rc as From<Vec<T>>

This commit is contained in:
July Tikhonov 2023-08-03 10:44:23 +03:00 committed by GitHub
parent fb31b3c34e
commit f1fc871ce6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2491,9 +2491,9 @@ impl<T, A: Allocator> From<Vec<T, A>> for Rc<[T], A> {
/// ///
/// ``` /// ```
/// # use std::rc::Rc; /// # use std::rc::Rc;
/// let original: Box<Vec<i32>> = Box::new(vec![1, 2, 3]); /// let unique: Vec<i32> = vec![1, 2, 3];
/// let shared: Rc<Vec<i32>> = Rc::from(original); /// let shared: Rc<[i32]> = Rc::from(unique);
/// assert_eq!(vec![1, 2, 3], *shared); /// assert_eq!(&[1, 2, 3], &shared[..]);
/// ``` /// ```
#[inline] #[inline]
fn from(v: Vec<T, A>) -> Rc<[T], A> { fn from(v: Vec<T, A>) -> Rc<[T], A> {