Remove the pointer module

This is now unused.
This commit is contained in:
Peter Ammon 2024-06-29 16:04:48 -07:00
parent c212ac95e9
commit 606b668fff
No known key found for this signature in database
2 changed files with 0 additions and 36 deletions

View File

@ -77,7 +77,6 @@ pub mod parse_util;
pub mod parser;
pub mod parser_keywords;
pub mod path;
pub mod pointer;
pub mod print_help;
pub mod proc;
pub mod re;

View File

@ -1,35 +0,0 @@
use std::ops::Deref;
/// Raw pointer that implements Default.
/// Additionally it implements Deref so it's more ergonomic than Option<std::ptr::NonNull>.
#[derive(Debug)]
pub struct ConstPointer<T>(pub *const T);
impl<T> From<&T> for ConstPointer<T> {
fn from(value: &T) -> Self {
Self(value)
}
}
impl<T> Default for ConstPointer<T> {
fn default() -> Self {
Self(std::ptr::null())
}
}
impl<T> Clone for ConstPointer<T> {
fn clone(&self) -> Self {
*self
}
}
impl<T> Copy for ConstPointer<T> {}
impl<T> Deref for ConstPointer<T> {
type Target = T;
fn deref(&self) -> &Self::Target {
assert!(!self.0.is_null());
unsafe { &*self.0 }
}
}