2023-10-31 17:37:40 -05:00
|
|
|
#![allow(unused)]
|
2022-12-07 01:26:48 -06:00
|
|
|
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),
|
|
|
|
}
|