Skip to content
Merged
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
12 changes: 12 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,18 @@ impl<T> Ordered<T> {
/// This allows: `let found = map.get(Ordered::from_ref(&a));`
#[allow(clippy::ptr_as_ptr)]
pub fn from_ref(value: &T) -> &Self { unsafe { &*(value as *const _ as *const Self) } }

/// Returns a reference to the inner object.
///
/// We also implement [`core::borrow::Borrow`] so this function is never explicitly needed.
#[deprecated(since = "0.3.0", note = "use `ops::Deref` instead")]
pub const fn as_inner(&self) -> &T { &self.0 }

/// Returns the inner object.
///
/// We also implement [`core::ops::Deref`] so this function is never explicitly needed.
#[deprecated(since = "0.3.0", note = "use `ops::Deref` instead")]
pub fn into_inner(self) -> T { self.0 }
}

impl<T: ArbitraryOrd> ArbitraryOrd for &T {
Expand Down
Loading