pub struct RawInterned<T = Prv>(/* private fields */)
where
T: ?Sized;Implementations§
Source§impl<T> RawInterned<T>where
T: ?Sized,
impl<T> RawInterned<T>where
T: ?Sized,
pub fn cast<U>(self) -> RawInterned<U>
Methods from Deref<Target = NonNull<T>>§
1.25.0 · Sourcepub unsafe fn as_ref<'a>(&self) -> &'a T
pub unsafe fn as_ref<'a>(&self) -> &'a T
Returns a shared reference to the value. If the value may be uninitialized, as_uninit_ref
must be used instead.
For the mutable counterpart see as_mut.
§Safety
When calling this method, you have to ensure that the pointer is convertible to a reference.
§Examples
use std::ptr::NonNull;
let mut x = 0u32;
let ptr = NonNull::new(&mut x as *mut _).expect("ptr is null!");
let ref_x = unsafe { ptr.as_ref() };
println!("{ref_x}");Trait Implementations§
Source§impl<T> Clone for RawInterned<T>where
T: ?Sized,
impl<T> Clone for RawInterned<T>where
T: ?Sized,
Source§fn clone(&self) -> RawInterned<T>
fn clone(&self) -> RawInterned<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T> Debug for RawInterned<T>where
T: ?Sized,
impl<T> Debug for RawInterned<T>where
T: ?Sized,
Source§impl<T> Deref for RawInterned<T>where
T: ?Sized,
impl<T> Deref for RawInterned<T>where
T: ?Sized,
Source§impl<T> Hash for RawInterned<T>where
T: ?Sized,
impl<T> Hash for RawInterned<T>where
T: ?Sized,
Source§impl<T> Ord for RawInterned<T>where
T: ?Sized,
Pointer comparison by address.
impl<T> Ord for RawInterned<T>where
T: ?Sized,
Pointer comparison by address.
Source§fn cmp(&self, other: &RawInterned<T>) -> Ordering
fn cmp(&self, other: &RawInterned<T>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<T> PartialEq for RawInterned<T>where
T: ?Sized,
Pointer comparison by address.
impl<T> PartialEq for RawInterned<T>where
T: ?Sized,
Pointer comparison by address.
Source§impl<T> PartialOrd for RawInterned<T>where
T: ?Sized,
Pointer comparison by address.
impl<T> PartialOrd for RawInterned<T>where
T: ?Sized,
Pointer comparison by address.
impl<T> Copy for RawInterned<T>where
T: ?Sized,
impl<T> Eq for RawInterned<T>where
T: ?Sized,
Pointer comparison by address.
Auto Trait Implementations§
impl<T> Freeze for RawInterned<T>where
T: ?Sized,
impl<T> RefUnwindSafe for RawInterned<T>where
T: RefUnwindSafe + ?Sized,
impl<T = Prv> !Send for RawInterned<T>
impl<T = Prv> !Sync for RawInterned<T>
impl<T> Unpin for RawInterned<T>where
T: ?Sized,
impl<T> UnwindSafe for RawInterned<T>where
T: RefUnwindSafe + ?Sized,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.