feat: graph (WIP)

This commit is contained in:
2025-08-15 12:38:11 +08:00
parent d8ad7fe904
commit 3c7722a3d2
7 changed files with 78 additions and 30 deletions

View File

@@ -1,4 +1,4 @@
use std::{marker::PhantomPinned, ops::Deref};
use std::{marker::PhantomPinned, ops::{Deref, DerefMut}};
use bumpalo::{Bump, boxed::Box};
use hashbrown::HashMap;
@@ -32,6 +32,12 @@ struct Pin<'bump, T> {
_marker: PhantomPinned,
}
impl<T> Pin<'_, T> {
fn into_inner(self) -> T {
Box::into_inner(self.ptr)
}
}
impl<T> Deref for Pin<'_, T> {
type Target = T;
fn deref(&self) -> &Self::Target {
@@ -39,6 +45,12 @@ impl<T> Deref for Pin<'_, T> {
}
}
impl<T> DerefMut for Pin<'_, T> {
fn deref_mut(&mut self) -> &mut Self::Target {
self.ptr.as_mut()
}
}
impl<'bump, T> Pin<'bump, T> {
fn new_in(x: T, bump: &'bump Bump) -> Self {
Self {