MCPcopy Index your code
hub / github.com/encounter/objdiff / read

Function read

objdiff-core/src/obj/read.rs:1056–1070  ·  view source on GitHub ↗
(
    obj_path: &std::path::Path,
    config: &DiffObjConfig,
    diff_side: DiffSide,
)

Source from the content-addressed store, hash-verified

1054
1055#[cfg(feature = "std")]
1056pub fn read(
1057 obj_path: &std::path::Path,
1058 config: &DiffObjConfig,
1059 diff_side: DiffSide,
1060) -> Result<Object> {
1061 let (data, timestamp) = {
1062 let file = std::fs::File::open(obj_path)?;
1063 let timestamp = filetime::FileTime::from_last_modification_time(&file.metadata()?);
1064 (unsafe { memmap2::Mmap::map(&file) }?, timestamp)
1065 };
1066 let mut obj = parse(&data, config, diff_side)?;
1067 obj.path = Some(obj_path.to_path_buf());
1068 obj.timestamp = Some(timestamp);
1069 Ok(obj)
1070}
1071
1072pub fn parse(data: &[u8], config: &DiffObjConfig, diff_side: DiffSide) -> Result<Object> {
1073 let obj_file = object::File::parse(data)?;

Callers 6

load_fontFunction · 0.85
compile_protosFunction · 0.85
run_buildFunction · 0.85
report_objectFunction · 0.85
run_oneshotFunction · 0.85
run_interactiveFunction · 0.85

Calls 1

parseFunction · 0.85

Tested by

no test coverage detected