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:
commit
443881a37b
1 changed files with 15 additions and 2 deletions
|
@ -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]
|
||||
|
|
Loading…
Reference in a new issue