@@ -3565,6 +3565,26 @@ impl<T: Clone> From<&[T]> for Arc<[T]> {
3565
3565
}
3566
3566
}
3567
3567
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
+
3568
3588
#[ cfg( not( no_global_oom_handling) ) ]
3569
3589
#[ stable( feature = "shared_from_slice" , since = "1.21.0" ) ]
3570
3590
impl From < & str > for Arc < str > {
@@ -3584,6 +3604,26 @@ impl From<&str> for Arc<str> {
3584
3604
}
3585
3605
}
3586
3606
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
+
3587
3627
#[ cfg( not( no_global_oom_handling) ) ]
3588
3628
#[ stable( feature = "shared_from_slice" , since = "1.21.0" ) ]
3589
3629
impl From < String > for Arc < str > {
0 commit comments