Skip to main content

Crate skilllite_fs

Crate skilllite_fs 

Source
Expand description

SkillLite FS: 中心化文件操作

模块:

  • read_write: read_file, write_file, append_file, atomic_write
  • dir: read_dir, list_directory, file_exists, create_dir_all, copy, rename, remove_file, modified_time
  • grep: grep_directory
  • search_replace: apply_search_replace, apply_replace_fuzzy, insert_lines_at
  • backup: backup_file, prune_oldest_files
  • util: is_likely_binary, matches_glob

Structs§

FuzzyReplaceResult
模糊匹配结果

Enums§

PathKind
路径类型

Constants§

SKIP_DIRS
默认跳过的目录

Functions§

append_file
追加写入文件
apply_replace_fuzzy
精确或模糊替换(单次替换时启用 fuzzy fallback)
apply_replace_normalize_whitespace
normalize_whitespace 模式:忽略行尾空白
apply_search_replace
纯内存:精确 search_replace
atomic_write
原子写入:先写 .tmp 再 rename
backup_file
备份文件到 backup_dir,返回备份路径
build_failure_hint
copy
复制文件
create_dir_all
确保目录存在
file_exists
检查路径是否存在及类型
grep_directory
递归 grep 目录,返回匹配行
insert_lines_at
在指定行后插入内容,支持 auto-indent
is_likely_binary
检测文件是否可能为二进制(前 512 字节含 null)
line_byte_offsets
行首字节偏移
list_directory
列出目录内容,返回排序后的条目
matches_glob
简单 glob 匹配:支持 *.ext 或精确文件名
modified_time
获取修改时间
prune_oldest_files
清理目录中最老的条目,保留 keep 个
read_bytes
读取文件为原始字节
read_bytes_limit
读取文件前 limit 字节(用于二进制检测等)
read_dir
读取目录条目,返回 (完整路径, 是否目录),已排序
read_file
读取文件为 UTF-8 字符串
remove_file
删除文件
rename
重命名/移动
safe_excerpt
安全截取片段(避免在字符中间切断)
search_replace_file
在文件内做精确 search_replace,返回替换次数
write_file
写入文件(覆盖),UTF-8

Type Aliases§

GrepMatch
单条匹配:(相对路径, 行号, 行内容)