pub struct ChunkMetadata {
pub source_type: String,
pub path: Option<String>,
pub commit: Option<String>,
pub author: Option<String>,
pub date: Option<String>,
pub base_offset: usize,
pub base_line: usize,
pub mtime_ns: Option<u64>,
pub size_bytes: Option<u64>,
}Expand description
Metadata that tracks the source location for a scanned chunk.
§Examples
use keyhog_core::ChunkMetadata;
let metadata = ChunkMetadata {
source_type: "git-diff".into(),
path: Some("src/lib.rs".into()),
commit: Some("abc123".into()),
author: Some("Dev".into()),
date: Some("2026-03-26T00:00:00Z".into()),
..Default::default()
};
assert_eq!(metadata.source_type, "git-diff");Fields§
§source_type: String§path: Option<String>§commit: Option<String>§date: Option<String>§base_offset: usize§base_line: usizeNumber of lines that precede base_offset in the original file -
the line-number analog of base_offset. Zero for whole-file chunks
(single-pass mmap, stdin, http, git diffs). Non-zero only when a
source slices one file into multiple chunks (the filesystem
>window_size windowed path), where each window after the first
starts partway through the file. The scanner computes a match’s
line number within the chunk text and adds this base so the
reported line is the absolute file line, not the per-window one -
exactly mirroring how base_offset makes the byte offset absolute.
Without it, a secret on line 584307 of a 70 MiB file was reported
at the window-local line (e.g. line 2), making findings impossible
to locate.
mtime_ns: Option<u64>File mtime in nanoseconds since UNIX epoch, when the source can surface it cheaply (filesystem walks). Optional because non-fs sources (stdin, http, git diffs) don’t have a meaningful mtime. Populated to drive the merkle-index metadata fast-path.
size_bytes: Option<u64>File size in bytes, when known cheaply at chunk-production time.
Same shape and rationale as mtime_ns.
Trait Implementations§
Source§impl Clone for ChunkMetadata
impl Clone for ChunkMetadata
Source§fn clone(&self) -> ChunkMetadata
fn clone(&self) -> ChunkMetadata
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ChunkMetadata
impl Debug for ChunkMetadata
Source§impl Default for ChunkMetadata
impl Default for ChunkMetadata
Source§fn default() -> ChunkMetadata
fn default() -> ChunkMetadata
Auto Trait Implementations§
impl Freeze for ChunkMetadata
impl RefUnwindSafe for ChunkMetadata
impl Send for ChunkMetadata
impl Sync for ChunkMetadata
impl Unpin for ChunkMetadata
impl UnsafeUnpin for ChunkMetadata
impl UnwindSafe for ChunkMetadata
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more