We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a7890c7 commit 2727c3bCopy full SHA for 2727c3b
library/alloc/src/sync.rs
@@ -2300,6 +2300,20 @@ impl<T: ?Sized + Hash> Hash for Arc<T> {
2300
2301
#[stable(feature = "from_for_ptrs", since = "1.6.0")]
2302
impl<T> From<T> for Arc<T> {
2303
+ /// Converts a `T` into an `Arc<T>`
2304
+ ///
2305
+ /// The conversion moves the value into a
2306
+ /// newly allocated `Arc`. It is equivalent to
2307
+ /// calling `Arc::new(t)`.
2308
2309
+ /// # Example
2310
+ /// ```rust
2311
+ /// # use std::sync::Arc;
2312
+ /// let x = 5;
2313
+ /// let arc = Arc::new(5);
2314
2315
+ /// assert_eq!(Arc::from(x), arc);
2316
+ /// ```
2317
fn from(t: T) -> Self {
2318
Arc::new(t)
2319
}
0 commit comments