File tree Expand file tree Collapse file tree 1 file changed +3
-14
lines changed
Expand file tree Collapse file tree 1 file changed +3
-14
lines changed Original file line number Diff line number Diff line change 11use crate :: buildin:: Node ;
22
3- pub trait DeviceTreeTraversal {
4- fn find ( & self , _path : & str ) -> Option < Node > {
5- None
6- }
7- fn search < F > ( & self , _func : & mut F )
8- where
9- F : FnMut ( & Node ) ,
10- {
11- }
12- }
13-
14- impl DeviceTreeTraversal for Node < ' _ > {
3+ impl Node < ' _ > {
154 /// Try to get a node by path
16- fn find ( & self , path : & str ) -> Option < Node > {
5+ pub fn find ( & self , path : & str ) -> Option < Node > {
176 // Direct return root node
187 let mut current_node = Some ( self . clone ( ) ) ;
198 if path == "/" {
@@ -49,7 +38,7 @@ impl DeviceTreeTraversal for Node<'_> {
4938 }
5039
5140 /// use depth-first search to traversal the tree, and exec func for each node
52- fn search < F > ( & self , func : & mut F )
41+ pub fn search < F > ( & self , func : & mut F )
5342 where
5443 F : FnMut ( & Node ) ,
5544 {
You can’t perform that action at this time.
0 commit comments