-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removes unused binaries, implements ArenaTree, commands rw
- Loading branch information
1 parent
c02b9a0
commit fcc380c
Showing
10 changed files
with
64 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[package] | ||
name = "gawires-gist" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fn main() { | ||
println!("Hello, world!"); | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,41 @@ | ||
use crate::core::tree::ArenaTree; | ||
use crate::core::diff::Diff; | ||
use std::cell::RefCell; | ||
use std::process::Child; | ||
use std::rc::Rc; | ||
|
||
type DiffTreeNode = Rc<RefCell<DiffTree>>; | ||
|
||
struct DiffTree{ | ||
internal_structure: ArenaTree<Diff>, | ||
parent: Box<Option<DiffTree>>, | ||
parent: Option<DiffTreeNode>, | ||
children: Vec<DiffTreeNode>, | ||
} | ||
|
||
impl DiffTree{ | ||
|
||
pub fn new(internal_structure: ArenaTree<Diff>) -> DiffTreeNode{ | ||
Rc::new(RefCell::new(DiffTree { | ||
internal_structure, | ||
parent: None, | ||
children: Vec::new(), | ||
} | ||
))} | ||
|
||
pub fn add_child(parent: &DiffTreeNode, internal_structure: ArenaTree<Diff>) -> DiffTreeNode{ | ||
let child = DiffTree::new(internal_structure); | ||
child.borrow_mut().parent = Some(Rc::clone(parent)); | ||
parent.borrow_mut().children.push(Rc::clone(&child)); | ||
|
||
child | ||
} | ||
|
||
pub fn display(node: &DiffTreeNode, depth: usize){ | ||
let indent = " ".repeat(depth*2); | ||
println!("{}Node: {:?}",indent,node.borrow().internal_structure); | ||
|
||
for child in &node.borrow().children { | ||
DiffTree::display(child, depth + 1); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
#![feature(const_option)] | ||
|
||
mod cli; | ||
use paw::Args; | ||
pub use clap::Parser; | ||
|