refactor: remove many unwrap calls

This commit is contained in:
Nova
2023-01-25 11:50:53 -05:00
parent b5e87d5911
commit 529b86fa91
26 changed files with 163 additions and 133 deletions

View File

@@ -17,11 +17,11 @@ pub struct Root {
logic_step: AtomicBool,
}
impl Root {
pub fn create(client: &Arc<Client>) -> Arc<Self> {
pub fn create(client: &Arc<Client>) -> Result<Arc<Self>> {
let node = Node::create(client, "", "", false);
node.add_local_signal("subscribe_logic_step", Root::subscribe_logic_step);
node.add_local_signal("set_base_prefixes", Root::set_base_prefixes);
let node = node.add_to_scenegraph();
let node = node.add_to_scenegraph()?;
let _ = Spatial::add_to(
&node,
None,
@@ -33,10 +33,10 @@ impl Root {
false,
);
ROOT_REGISTRY.add(Root {
Ok(ROOT_REGISTRY.add(Root {
node,
logic_step: AtomicBool::from(false),
})
}))
}
fn subscribe_logic_step(_node: &Node, calling_client: Arc<Client>, _data: &[u8]) -> Result<()> {