pub struct NodeSummary {
pub size: u64,
pub count: u64,
pub updated_at: Option<SystemTime>,
pub suffixes: Vec<String>,
}Expand description
节点总结信息
- size: 磁盘占用大小
- count: 包含文本行数
- updated_at: 最后更新时间
- suffixes: 后缀
- 文件:当前文件的后缀
- 目录:当前目录下所有文件的后缀
Fields§
§size: u64u64 磁盘占用大小,默认为 0
count: u64u64 包含文本行数,默认为 0
updated_at: Option<SystemTime>最后更新时间,若没有启动 project_tree.summarize 则为空
suffixes: Vec<String>包含的文件后缀,默认为空
Implementations§
Source§impl NodeSummary
impl NodeSummary
Sourcepub fn update(node: &mut TreeNode) -> NodeSummary
pub fn update(node: &mut TreeNode) -> NodeSummary
更新节点的总结信息
- node:{&mut TreeNode} 可变节点实例
- return:{NodeSummary}
该函数属于
NodeSummary模块,不直接绑定于TreeNode,即不直接修改TreeNode.summary若有手动更新某节点信息的需求,则需要在调用该函数后手动赋值node.summary = summary;但在某节点的update过程中,子节点的summary会自动赋值,无需手动处理,最终返回的总结信息为当前启动节点的总结信息
§Examples
use arui_core::tree::node::TreeNode;
use arui_core::tree::summary::NodeSummary;
const BASE_URL: &str = "./tests/examples/tree/summary";
let mut node = TreeNode::new(BASE_URL, true);
let sub_node = TreeNode::new(format!("{}/test.rs", BASE_URL), false);
node.children = Some(vec![sub_node]);
let summary = NodeSummary::update(&mut node);
// 手动赋值!
node.summary = summary;
assert_eq!(node.summary.size > 0, true);
assert_eq!(node.summary.count > 0, true);Trait Implementations§
Source§impl Clone for NodeSummary
impl Clone for NodeSummary
Source§fn clone(&self) -> NodeSummary
fn clone(&self) -> NodeSummary
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for NodeSummary
impl Debug for NodeSummary
Auto Trait Implementations§
impl Freeze for NodeSummary
impl RefUnwindSafe for NodeSummary
impl Send for NodeSummary
impl Sync for NodeSummary
impl Unpin for NodeSummary
impl UnsafeUnpin for NodeSummary
impl UnwindSafe for NodeSummary
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more