Rollup merge of #53506 - phungleson:fix-from-docs-atomic, r=KodrAus

Documentation for impl From for AtomicBool and other Atomic types

As part of issue #51430 (cc @skade).

The impl is very simple, so not sure if we need to go into any details.
This commit is contained in:
Mazdak Farrokhzad 2018-12-16 14:08:13 +01:00 committed by GitHub
commit 443881a37b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1072,6 +1072,15 @@ impl<T> AtomicPtr<T> {
#[cfg(target_has_atomic = "8")]
#[stable(feature = "atomic_bool_from", since = "1.24.0")]
impl From<bool> for AtomicBool {
/// Converts a `bool` into an `AtomicBool`.
///
/// # Examples
///
/// ```
/// use std::sync::atomic::AtomicBool;
/// let atomic_bool = AtomicBool::from(true);
/// assert_eq!(format!("{:?}", atomic_bool), "true")
/// ```
#[inline]
fn from(b: bool) -> Self { Self::new(b) }
}
@ -1126,8 +1135,12 @@ macro_rules! atomic_int {
#[$stable_from]
impl From<$int_type> for $atomic_type {
#[inline]
fn from(v: $int_type) -> Self { Self::new(v) }
doc_comment! {
concat!(
"Converts an `", stringify!($int_type), "` into an `", stringify!($atomic_type), "`."),
#[inline]
fn from(v: $int_type) -> Self { Self::new(v) }
}
}
#[$stable_debug]