refactor(spatial): remove explicit lifetime specifier
This commit is contained in:
@@ -15,7 +15,7 @@ pub struct Node<'a> {
|
|||||||
local_methods: HashMap<String, Method>,
|
local_methods: HashMap<String, Method>,
|
||||||
destroyable: bool,
|
destroyable: bool,
|
||||||
|
|
||||||
pub spatial: Option<Rc<Spatial<'a>>>,
|
pub spatial: Option<Rc<Spatial>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Node<'a> {
|
impl<'a> Node<'a> {
|
||||||
|
|||||||
@@ -9,18 +9,14 @@ use rccell::RcCell;
|
|||||||
use std::cell::{Cell, RefCell};
|
use std::cell::{Cell, RefCell};
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
pub struct Spatial<'a> {
|
pub struct Spatial {
|
||||||
// node: WeakCell<Node<'a>>,
|
// node: WeakCell<Node<'a>>,
|
||||||
parent: RefCell<Option<Rc<Spatial<'a>>>>,
|
parent: RefCell<Option<Rc<Spatial>>>,
|
||||||
transform: Cell<Mat4>,
|
transform: Cell<Mat4>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Spatial<'a> {
|
impl Spatial {
|
||||||
pub fn add_to(
|
pub fn add_to(node: RcCell<Node>, parent: Option<Rc<Spatial>>, transform: Mat4) -> Result<()> {
|
||||||
node: RcCell<Node<'a>>,
|
|
||||||
parent: Option<Rc<Spatial<'a>>>,
|
|
||||||
transform: Mat4,
|
|
||||||
) -> Result<()> {
|
|
||||||
if node.borrow_mut().spatial.is_none() {
|
if node.borrow_mut().spatial.is_none() {
|
||||||
bail!("Node already has a Spatial aspect!");
|
bail!("Node already has a Spatial aspect!");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user