Skip to content

Commit

Permalink
Documentation for impl From for AtomicBool and other Atomic types
Browse files Browse the repository at this point in the history
  • Loading branch information
phungleson committed Dec 11, 2018
1 parent a9fe312 commit 94c1c73
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/libcore/sync/atomic.rs
Expand Up @@ -1066,6 +1066,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) }
}
Expand Down Expand Up @@ -1119,8 +1128,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]
Expand Down

0 comments on commit 94c1c73

Please sign in to comment.