From 4e79073e3872df718eb189dd5301ffc000f87d58 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Jul 2018 02:23:01 +0300 Subject: Use raw pointers --- src/yellow/red.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/yellow/red.rs') diff --git a/src/yellow/red.rs b/src/yellow/red.rs index e2dbceeae..3fdbfe0c5 100644 --- a/src/yellow/red.rs +++ b/src/yellow/red.rs @@ -1,7 +1,7 @@ use std::sync::{Arc, RwLock}; use { TextUnit, - yellow::{Ptr, GreenNode}, + yellow::GreenNode, }; #[derive(Debug)] @@ -13,7 +13,7 @@ pub(crate) struct RedNode { #[derive(Debug)] struct ParentData { - parent: Ptr, + parent: *const RedNode, start_offset: TextUnit, index_in_parent: usize, } @@ -27,7 +27,7 @@ impl RedNode { fn new_child( green: GreenNode, - parent: Ptr, + parent: *const RedNode, start_offset: TextUnit, index_in_parent: usize, ) -> RedNode { @@ -62,7 +62,7 @@ impl RedNode { self.green.children().len() } - pub(crate) fn nth_child(&self, me: Ptr, idx: usize) -> Arc { + pub(crate) fn nth_child(&self, idx: usize) -> Arc { match &self.children.read().unwrap()[idx] { Some(child) => return child.clone(), None => (), @@ -72,7 +72,7 @@ impl RedNode { let green_children = self.green.children(); let start_offset = self.start_offset() + green_children[..idx].iter().map(|x| x.text_len()).sum::(); - let child = RedNode::new_child(green_children[idx].clone(), me, start_offset, idx); + let child = RedNode::new_child(green_children[idx].clone(), self, start_offset, idx); children[idx] = Some(Arc::new(child)) } children[idx].as_ref().unwrap().clone() -- cgit v1.2.3