Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions crossbeam-epoch/src/atomic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -891,8 +891,9 @@ impl<T> From<*const T> for Atomic<T> {
}

/// A trait for either `Owned` or `Shared` pointers.
// TODO: seal this trait https://github.com/crossbeam-rs/crossbeam/issues/620
pub trait Pointer<T: ?Sized + Pointable> {
///
/// This trait is sealed and cannot be implemented for types outside of `crossbeam-epoch`.
pub trait Pointer<T: ?Sized + Pointable>: crate::sealed::Sealed {
/// Returns the machine representation of the pointer.
fn into_ptr(self) -> *mut ();

Expand All @@ -916,6 +917,7 @@ pub struct Owned<T: ?Sized + Pointable> {
_marker: PhantomData<Box<T>>,
}

impl<T: ?Sized + Pointable> crate::sealed::Sealed for Owned<T> {}
impl<T: ?Sized + Pointable> Pointer<T> for Owned<T> {
#[inline]
fn into_ptr(self) -> *mut () {
Expand Down Expand Up @@ -1176,6 +1178,7 @@ impl<T: ?Sized + Pointable> Clone for Shared<'_, T> {

impl<T: ?Sized + Pointable> Copy for Shared<'_, T> {}

impl<T: ?Sized + Pointable> crate::sealed::Sealed for Shared<'_, T> {}
impl<T: ?Sized + Pointable> Pointer<T> for Shared<'_, T> {
#[inline]
fn into_ptr(self) -> *mut () {
Expand Down
4 changes: 4 additions & 0 deletions crossbeam-epoch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ cfg_if! {
};
pub use self::collector::{Collector, LocalHandle};
pub use self::guard::{unprotected, Guard};

mod sealed {
pub trait Sealed {}
}
}
}

Expand Down