pub struct SecretsSidecar {
pub version: u32,
pub secret_line_ranges: Vec<SecretLineRange>,
}Expand description
Per-file secrets sidecar — the on-disk shape of secret_line_ranges.
Schema is intentionally minimal: a version field and the slice of
SecretLineRange entries the preprocessor emitted on the last
successful render. Stored next to the baseline as
<filename>.secret.json. See secrets.lex §3.3.
No baseline migration: this file is purely additive. Pre-secrets
renders simply have no sidecar, which the load path treats as
secret_line_ranges = [] (empty mask, byte-equivalent to legacy
reverse-merge behaviour).
Fields§
§version: u32Schema version. Bumps independently of the baseline schema — they’re separate files with separate evolution paths.
secret_line_ranges: Vec<SecretLineRange>Line ranges produced on the last successful render. Empty when the file’s template renders without secrets (an explicit empty-array sidecar is fine; absence of the file is also fine and means the same thing).
Implementations§
Source§impl SecretsSidecar
impl SecretsSidecar
Sourcepub fn new(ranges: Vec<SecretLineRange>) -> Self
pub fn new(ranges: Vec<SecretLineRange>) -> Self
Build a sidecar from a slice of line ranges.
Sourcepub fn write(
&self,
fs: &dyn Fs,
paths: &dyn Pather,
pack: &str,
handler: &str,
filename: &str,
) -> Result<Option<PathBuf>>
pub fn write( &self, fs: &dyn Fs, paths: &dyn Pather, pack: &str, handler: &str, filename: &str, ) -> Result<Option<PathBuf>>
Persist the sidecar next to its baseline. Path layout matches
Pather::preprocessor_secrets_sidecar_path. Creates parent
directories as needed (in practice the baseline write that
runs first has already created them, but write is robust to
being called in either order). Overwrites any existing file.
When self.secret_line_ranges is empty, this is a no-op:
callers don’t need to special-case “no secrets” — they always
call write with whatever the renderer emitted, and the
no-secrets case skips the disk write rather than dropping a
{ "secret_line_ranges": [] } file. Removes any existing
sidecar in that case so a previous render’s secrets don’t
linger after the user removes them from the template.
Sourcepub fn load(
fs: &dyn Fs,
paths: &dyn Pather,
pack: &str,
handler: &str,
filename: &str,
) -> Result<Option<Self>>
pub fn load( fs: &dyn Fs, paths: &dyn Pather, pack: &str, handler: &str, filename: &str, ) -> Result<Option<Self>>
Load the sidecar for a file. Returns Ok(None) when no
sidecar exists — the documented “no secrets” state per §3.3.
Errors on parse failure or unsupported version so the caller
can suggest a dodot up --force re-render.
Trait Implementations§
Source§impl Clone for SecretsSidecar
impl Clone for SecretsSidecar
Source§fn clone(&self) -> SecretsSidecar
fn clone(&self) -> SecretsSidecar
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SecretsSidecar
impl Debug for SecretsSidecar
Source§impl<'de> Deserialize<'de> for SecretsSidecar
impl<'de> Deserialize<'de> for SecretsSidecar
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for SecretsSidecar
impl PartialEq for SecretsSidecar
Source§impl Serialize for SecretsSidecar
impl Serialize for SecretsSidecar
impl Eq for SecretsSidecar
impl StructuralPartialEq for SecretsSidecar
Auto Trait Implementations§
impl Freeze for SecretsSidecar
impl RefUnwindSafe for SecretsSidecar
impl Send for SecretsSidecar
impl Sync for SecretsSidecar
impl Unpin for SecretsSidecar
impl UnsafeUnpin for SecretsSidecar
impl UnwindSafe for SecretsSidecar
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.