mirror of
https://github.com/hannobraun/Fornjot
synced 2025-02-25 16:45:52 +00:00
Document Storage
This commit is contained in:
parent
f408a2ec77
commit
00f59db483
@ -38,14 +38,17 @@ impl<T> Deref for Handle<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Internal type used in collections within [`Shape`]
|
||||||
#[derive(Debug, Eq, PartialEq, Hash, Ord, PartialOrd)]
|
#[derive(Debug, Eq, PartialEq, Hash, Ord, PartialOrd)]
|
||||||
pub(super) struct Storage<T>(Rc<T>);
|
pub(super) struct Storage<T>(Rc<T>);
|
||||||
|
|
||||||
impl<T> Storage<T> {
|
impl<T> Storage<T> {
|
||||||
|
/// Create a [`Storage`] instance that wraps the provided object
|
||||||
pub(super) fn new(value: T) -> Self {
|
pub(super) fn new(value: T) -> Self {
|
||||||
Self(Rc::new(value))
|
Self(Rc::new(value))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Create a handle that refers to this [`Storage`] instance
|
||||||
pub(super) fn handle(&self) -> Handle<T> {
|
pub(super) fn handle(&self) -> Handle<T> {
|
||||||
Handle(self.clone())
|
Handle(self.clone())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user