mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-06 04:08:40 +00:00
add tracking issue for exclusive
This commit is contained in:
parent
63d1c86230
commit
029f9aa3bf
@ -72,7 +72,7 @@ use core::task::{Context, Poll};
|
|||||||
///
|
///
|
||||||
///
|
///
|
||||||
/// [`Sync`]: core::marker::Sync
|
/// [`Sync`]: core::marker::Sync
|
||||||
#[unstable(feature = "exclusive_wrapper", issue = "none")]
|
#[unstable(feature = "exclusive_wrapper", issue = "98407")]
|
||||||
#[doc(alias = "SyncWrapper")]
|
#[doc(alias = "SyncWrapper")]
|
||||||
#[doc(alias = "SyncCell")]
|
#[doc(alias = "SyncCell")]
|
||||||
#[doc(alias = "Unique")]
|
#[doc(alias = "Unique")]
|
||||||
@ -86,10 +86,10 @@ pub struct Exclusive<T: ?Sized> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// See `Exclusive`'s docs for justification.
|
// See `Exclusive`'s docs for justification.
|
||||||
#[unstable(feature = "exclusive_wrapper", issue = "none")]
|
#[unstable(feature = "exclusive_wrapper", issue = "98407")]
|
||||||
unsafe impl<T: ?Sized> Sync for Exclusive<T> {}
|
unsafe impl<T: ?Sized> Sync for Exclusive<T> {}
|
||||||
|
|
||||||
#[unstable(feature = "exclusive_wrapper", issue = "none")]
|
#[unstable(feature = "exclusive_wrapper", issue = "98407")]
|
||||||
impl<T: ?Sized> fmt::Debug for Exclusive<T> {
|
impl<T: ?Sized> fmt::Debug for Exclusive<T> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
|
||||||
f.debug_struct("Exclusive").finish_non_exhaustive()
|
f.debug_struct("Exclusive").finish_non_exhaustive()
|
||||||
@ -98,14 +98,14 @@ impl<T: ?Sized> fmt::Debug for Exclusive<T> {
|
|||||||
|
|
||||||
impl<T: Sized> Exclusive<T> {
|
impl<T: Sized> Exclusive<T> {
|
||||||
/// Wrap a value in an `Exclusive`
|
/// Wrap a value in an `Exclusive`
|
||||||
#[unstable(feature = "exclusive_wrapper", issue = "none")]
|
#[unstable(feature = "exclusive_wrapper", issue = "98407")]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub const fn new(t: T) -> Self {
|
pub const fn new(t: T) -> Self {
|
||||||
Self { inner: t }
|
Self { inner: t }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Unwrap the value contained in the `Exclusive`
|
/// Unwrap the value contained in the `Exclusive`
|
||||||
#[unstable(feature = "exclusive_wrapper", issue = "none")]
|
#[unstable(feature = "exclusive_wrapper", issue = "98407")]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub const fn into_inner(self) -> T {
|
pub const fn into_inner(self) -> T {
|
||||||
self.inner
|
self.inner
|
||||||
@ -114,7 +114,7 @@ impl<T: Sized> Exclusive<T> {
|
|||||||
|
|
||||||
impl<T: ?Sized> Exclusive<T> {
|
impl<T: ?Sized> Exclusive<T> {
|
||||||
/// Get exclusive access to the underlying value.
|
/// Get exclusive access to the underlying value.
|
||||||
#[unstable(feature = "exclusive_wrapper", issue = "none")]
|
#[unstable(feature = "exclusive_wrapper", issue = "98407")]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub const fn get_mut(&mut self) -> &mut T {
|
pub const fn get_mut(&mut self) -> &mut T {
|
||||||
&mut self.inner
|
&mut self.inner
|
||||||
@ -126,7 +126,7 @@ impl<T: ?Sized> Exclusive<T> {
|
|||||||
/// value, which means _unpinned_ `Exclusive`s can produce _unpinned_
|
/// value, which means _unpinned_ `Exclusive`s can produce _unpinned_
|
||||||
/// access to the underlying value, but _pinned_ `Exclusive`s only
|
/// access to the underlying value, but _pinned_ `Exclusive`s only
|
||||||
/// produce _pinned_ access to the underlying value.
|
/// produce _pinned_ access to the underlying value.
|
||||||
#[unstable(feature = "exclusive_wrapper", issue = "none")]
|
#[unstable(feature = "exclusive_wrapper", issue = "98407")]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub const fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut T> {
|
pub const fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut T> {
|
||||||
// SAFETY: `Exclusive` can only produce `&mut T` if itself is unpinned
|
// SAFETY: `Exclusive` can only produce `&mut T` if itself is unpinned
|
||||||
@ -137,7 +137,7 @@ impl<T: ?Sized> Exclusive<T> {
|
|||||||
/// Build a _mutable_ references to an `Exclusive<T>` from
|
/// Build a _mutable_ references to an `Exclusive<T>` from
|
||||||
/// a _mutable_ reference to a `T`. This allows you to skip
|
/// a _mutable_ reference to a `T`. This allows you to skip
|
||||||
/// building an `Exclusive` with [`Exclusive::new`].
|
/// building an `Exclusive` with [`Exclusive::new`].
|
||||||
#[unstable(feature = "exclusive_wrapper", issue = "none")]
|
#[unstable(feature = "exclusive_wrapper", issue = "98407")]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub const fn from_mut(r: &'_ mut T) -> &'_ mut Exclusive<T> {
|
pub const fn from_mut(r: &'_ mut T) -> &'_ mut Exclusive<T> {
|
||||||
// SAFETY: repr is ≥ C, so refs have the same layout; and `Exclusive` properties are `&mut`-agnostic
|
// SAFETY: repr is ≥ C, so refs have the same layout; and `Exclusive` properties are `&mut`-agnostic
|
||||||
@ -147,7 +147,7 @@ impl<T: ?Sized> Exclusive<T> {
|
|||||||
/// Build a _pinned mutable_ references to an `Exclusive<T>` from
|
/// Build a _pinned mutable_ references to an `Exclusive<T>` from
|
||||||
/// a _pinned mutable_ reference to a `T`. This allows you to skip
|
/// a _pinned mutable_ reference to a `T`. This allows you to skip
|
||||||
/// building an `Exclusive` with [`Exclusive::new`].
|
/// building an `Exclusive` with [`Exclusive::new`].
|
||||||
#[unstable(feature = "exclusive_wrapper", issue = "none")]
|
#[unstable(feature = "exclusive_wrapper", issue = "98407")]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub const fn from_pin_mut(r: Pin<&'_ mut T>) -> Pin<&'_ mut Exclusive<T>> {
|
pub const fn from_pin_mut(r: Pin<&'_ mut T>) -> Pin<&'_ mut Exclusive<T>> {
|
||||||
// SAFETY: `Exclusive` can only produce `&mut T` if itself is unpinned
|
// SAFETY: `Exclusive` can only produce `&mut T` if itself is unpinned
|
||||||
@ -156,14 +156,14 @@ impl<T: ?Sized> Exclusive<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unstable(feature = "exclusive_wrapper", issue = "none")]
|
#[unstable(feature = "exclusive_wrapper", issue = "98407")]
|
||||||
impl<T> From<T> for Exclusive<T> {
|
impl<T> From<T> for Exclusive<T> {
|
||||||
fn from(t: T) -> Self {
|
fn from(t: T) -> Self {
|
||||||
Self::new(t)
|
Self::new(t)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unstable(feature = "exclusive_wrapper", issue = "none")]
|
#[unstable(feature = "exclusive_wrapper", issue = "98407")]
|
||||||
impl<T: Future + ?Sized> Future for Exclusive<T> {
|
impl<T: Future + ?Sized> Future for Exclusive<T> {
|
||||||
type Output = T::Output;
|
type Output = T::Output;
|
||||||
|
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
|
|
||||||
pub mod atomic;
|
pub mod atomic;
|
||||||
mod exclusive;
|
mod exclusive;
|
||||||
#[unstable(feature = "exclusive_wrapper", issue = "none")]
|
#[unstable(feature = "exclusive_wrapper", issue = "98407")]
|
||||||
pub use exclusive::Exclusive;
|
pub use exclusive::Exclusive;
|
||||||
|
@ -155,7 +155,7 @@
|
|||||||
pub use alloc_crate::sync::{Arc, Weak};
|
pub use alloc_crate::sync::{Arc, Weak};
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
pub use core::sync::atomic;
|
pub use core::sync::atomic;
|
||||||
#[unstable(feature = "exclusive_wrapper", issue = "none")]
|
#[unstable(feature = "exclusive_wrapper", issue = "98407")]
|
||||||
pub use core::sync::Exclusive;
|
pub use core::sync::Exclusive;
|
||||||
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
|
Loading…
Reference in New Issue
Block a user