@@ -3565,6 +3565,26 @@ impl<T: Clone> From<&[T]> for Arc<[T]> {
35653565 }
35663566}
35673567
3568+ #[ cfg( not( no_global_oom_handling) ) ]
3569+ #[ stable( feature = "shared_from_mut_slice" , since = "CURRENT_RUSTC_VERSION" ) ]
3570+ impl < T : Clone > From < & mut [ T ] > for Arc < [ T ] > {
3571+ /// Allocates a reference-counted slice and fills it by cloning `v`'s items.
3572+ ///
3573+ /// # Example
3574+ ///
3575+ /// ```
3576+ /// # use std::sync::Arc;
3577+ /// let mut original = [1, 2, 3];
3578+ /// let original: &mut [i32] = &mut original;
3579+ /// let shared: Arc<[i32]> = Arc::from(original);
3580+ /// assert_eq!(&[1, 2, 3], &shared[..]);
3581+ /// ```
3582+ #[ inline]
3583+ fn from ( v : & mut [ T ] ) -> Arc < [ T ] > {
3584+ Arc :: from ( & * v)
3585+ }
3586+ }
3587+
35683588#[ cfg( not( no_global_oom_handling) ) ]
35693589#[ stable( feature = "shared_from_slice" , since = "1.21.0" ) ]
35703590impl From < & str > for Arc < str > {
@@ -3584,6 +3604,26 @@ impl From<&str> for Arc<str> {
35843604 }
35853605}
35863606
3607+ #[ cfg( not( no_global_oom_handling) ) ]
3608+ #[ stable( feature = "shared_from_mut_slice" , since = "CURRENT_RUSTC_VERSION" ) ]
3609+ impl From < & mut str > for Arc < str > {
3610+ /// Allocates a reference-counted `str` and copies `v` into it.
3611+ ///
3612+ /// # Example
3613+ ///
3614+ /// ```
3615+ /// # use std::sync::Arc;
3616+ /// let mut original = String::from("eggplant");
3617+ /// let original: &mut str = &mut original;
3618+ /// let shared: Arc<str> = Arc::from(original);
3619+ /// assert_eq!("eggplant", &shared[..]);
3620+ /// ```
3621+ #[ inline]
3622+ fn from ( v : & mut str ) -> Arc < str > {
3623+ Arc :: from ( & * v)
3624+ }
3625+ }
3626+
35873627#[ cfg( not( no_global_oom_handling) ) ]
35883628#[ stable( feature = "shared_from_slice" , since = "1.21.0" ) ]
35893629impl From < String > for Arc < str > {
0 commit comments