pub struct RawInterned<T: ?Sized = Prv>(/* private fields */);Implementations§
Source§impl<T: ?Sized> RawInterned<T>
impl<T: ?Sized> RawInterned<T>
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: ?Sized> Clone for RawInterned<T>
impl<T: ?Sized> Clone for RawInterned<T>
Source§impl<T: ?Sized> Debug for RawInterned<T>
impl<T: ?Sized> Debug for RawInterned<T>
Source§impl<T: ?Sized> Deref for RawInterned<T>
impl<T: ?Sized> Deref for RawInterned<T>
Source§impl<T: ?Sized> Hash for RawInterned<T>
impl<T: ?Sized> Hash for RawInterned<T>
Source§impl<T: ?Sized> Ord for RawInterned<T>
Pointer comparison by address.
impl<T: ?Sized> Ord for RawInterned<T>
Pointer comparison by address.
Source§impl<T: ?Sized> PartialEq for RawInterned<T>
Pointer comparison by address.
impl<T: ?Sized> PartialEq for RawInterned<T>
Pointer comparison by address.
Source§impl<T: ?Sized> PartialOrd for RawInterned<T>
Pointer comparison by address.
impl<T: ?Sized> PartialOrd for RawInterned<T>
Pointer comparison by address.
impl<T: ?Sized> Copy for RawInterned<T>
impl<T: ?Sized> Eq for RawInterned<T>
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.