mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-11 05:18:26 +00:00
Simplify Handle
This commit is contained in:
parent
93f15fabf5
commit
9c50d2164d
@ -1,18 +1,23 @@
|
||||
use std::{cmp::Ordering, fmt, ops::Deref, rc::Rc};
|
||||
|
||||
use super::{HandleAny, OperationOutput};
|
||||
use super::{HandleAny, Operation};
|
||||
|
||||
pub struct Handle<T> {
|
||||
inner: Rc<dyn OperationOutput<T>>,
|
||||
inner: Rc<T>,
|
||||
}
|
||||
|
||||
impl<T> Handle<T> {
|
||||
pub fn new(inner: impl OperationOutput<T> + 'static) -> Self {
|
||||
pub fn new(inner: T) -> Self {
|
||||
Self {
|
||||
inner: Rc::new(inner),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Handle<T>
|
||||
where
|
||||
T: Operation + 'static,
|
||||
{
|
||||
pub fn to_any(&self) -> HandleAny {
|
||||
self.clone().into_any()
|
||||
}
|
||||
@ -34,7 +39,7 @@ impl<T> Deref for Handle<T> {
|
||||
type Target = T;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
self.inner.output()
|
||||
&self.inner
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user