[Rust]Making struct for getting directory path

ke na - Jul 21 - - Dev Community
#[derive(Serialize, Deserialize)]
struct DirNode{
    name:String,
    children:Vec<DirNode>,
}
Enter fullscreen mode Exit fullscreen mode

1:#[derive(Serialize, Deserialize)]
Making serialize and deserialize for struct to json
2:struct DirNode{}
Making struct named DirNode
3:children:Vec
'children' retain subdirectory's list.It means to make recursively storing a list of DirNode.
DirNode can contain multiple DirNode.
So 'children' can have subdirectories.
4:Vec
Making array can have multiple values by using heap allocation.

. . . .
Terabox Video Player