advent_of_code_2022/src/day07/file_tree.rs

23 lines
367 B
Rust
Raw Normal View History

2023-10-31 17:37:40 -05:00
#![allow(unused)]
use std::{rc::{Weak, Rc}, cell::RefCell};
#[derive(Debug)]
pub struct Dir {
parent: Option<Weak<RefCell<Dir>>>,
name: String,
children: Vec<Rc<RefCell<FileOrDir>>>
}
#[derive(Debug)]
pub struct File{
dir: Weak<RefCell<Dir>>,
size: usize,
name: String
}
#[derive(Debug)]
pub enum FileOrDir{
File(File),
Dir(Dir),
}