dr_decode is reached through free functions and there is one decoder; the clause's "a second implementation may be added without changing callers" is a claim nothing tests. The spec says so itself and has since the clause was rewritten to bytes-in; this is the outstanding half.
Why
D2 keeps LibRaw behind a trait as the fallback for camera coverage rawler lacks, and S7 (never run, #48) is what would say whether that day is near. Introducing the trait after a second decoder exists means changing every caller at the moment there is most pressure not to; introducing it now costs a rename.
Deliverable
A Decoder trait over metadata(&[u8]), decode(&[u8], …), preview(&[u8]) and HEADER_BYTES, with the rawler path as its one implementation.
Callers take &dyn Decoder or a generic; the free functions become the default's.
A test that substitutes a stub decoder and shows the catalog scan, the preview ladder and export unchanged.
Acceptance
No path-based or SourceRef-based entry point appears (the property the clause is actually for)
The stub-decoder test exists and would fail if a caller named the concrete decoder
TRACES: FR-RAW-2 on the trait and the test
**`dr_decode` is reached through free functions and there is one decoder; the clause's "a second implementation may be added without changing callers" is a claim nothing tests.** The spec says so itself and has since the clause was rewritten to bytes-in; this is the outstanding half.
## Why
D2 keeps LibRaw behind a trait as the fallback for camera coverage rawler lacks, and S7 (never run, #48) is what would say whether that day is near. Introducing the trait *after* a second decoder exists means changing every caller at the moment there is most pressure not to; introducing it now costs a rename.
## Deliverable
- A `Decoder` trait over `metadata(&[u8])`, `decode(&[u8], …)`, `preview(&[u8])` and `HEADER_BYTES`, with the rawler path as its one implementation.
- Callers take `&dyn Decoder` or a generic; the free functions become the default's.
- A test that substitutes a stub decoder and shows the catalog scan, the preview ladder and export unchanged.
## Acceptance
- [ ] No path-based or `SourceRef`-based entry point appears (the property the clause is actually for)
- [ ] The stub-decoder test exists and would fail if a caller named the concrete decoder
- [ ] `TRACES: FR-RAW-2` on the trait and the test
pub trait Decoder in core/dr-decode/src/decoder.rs, taking bytes only: header_bytes, metadata, orientation, locate_preview, preview, decode. Rawler implements it by calling the existing functions, so behaviour is unchanged; dr_decode::default() hands it out.
Callers in dr-ui (load, library scan and previews, import, export, merge, repairs) take &dyn Decoder. The default is named only where a job starts.
ui/dr-ui/src/decoder_seam.rs hands a stub decoder for a made-up container to the catalog scan, the preview ladder and export, and asserts on values only the stub produces. It was checked to fail when two callers were pointed back at the concrete functions.
TRACES: FR-RAW-2; requirements.md now says the trait is built and the LibRaw decoder is not.
Left open: the linear-DNG date fallback (trailing_ifd/metadata_split) still calls the free functions, and the stub test does not cover merge and repairs.
Merged to master: d8fb382, 414094b, 733a033.
- `pub trait Decoder` in `core/dr-decode/src/decoder.rs`, taking bytes only: `header_bytes`, `metadata`, `orientation`, `locate_preview`, `preview`, `decode`. `Rawler` implements it by calling the existing functions, so behaviour is unchanged; `dr_decode::default()` hands it out.
- Callers in dr-ui (load, library scan and previews, import, export, merge, repairs) take `&dyn Decoder`. The default is named only where a job starts.
- `ui/dr-ui/src/decoder_seam.rs` hands a stub decoder for a made-up container to the catalog scan, the preview ladder and export, and asserts on values only the stub produces. It was checked to fail when two callers were pointed back at the concrete functions.
- `TRACES: FR-RAW-2`; requirements.md now says the trait is built and the LibRaw decoder is not.
Left open: the linear-DNG date fallback (`trailing_ifd`/`metadata_split`) still calls the free functions, and the stub test does not cover merge and repairs.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
dr_decodeis reached through free functions and there is one decoder; the clause's "a second implementation may be added without changing callers" is a claim nothing tests. The spec says so itself and has since the clause was rewritten to bytes-in; this is the outstanding half.Why
D2 keeps LibRaw behind a trait as the fallback for camera coverage rawler lacks, and S7 (never run, #48) is what would say whether that day is near. Introducing the trait after a second decoder exists means changing every caller at the moment there is most pressure not to; introducing it now costs a rename.
Deliverable
Decodertrait overmetadata(&[u8]),decode(&[u8], …),preview(&[u8])andHEADER_BYTES, with the rawler path as its one implementation.&dyn Decoderor a generic; the free functions become the default's.Acceptance
SourceRef-based entry point appears (the property the clause is actually for)TRACES: FR-RAW-2on the trait and the testMerged to master:
d8fb382,414094b,733a033.pub trait Decoderincore/dr-decode/src/decoder.rs, taking bytes only:header_bytes,metadata,orientation,locate_preview,preview,decode.Rawlerimplements it by calling the existing functions, so behaviour is unchanged;dr_decode::default()hands it out.&dyn Decoder. The default is named only where a job starts.ui/dr-ui/src/decoder_seam.rshands a stub decoder for a made-up container to the catalog scan, the preview ladder and export, and asserts on values only the stub produces. It was checked to fail when two callers were pointed back at the concrete functions.TRACES: FR-RAW-2; requirements.md now says the trait is built and the LibRaw decoder is not.Left open: the linear-DNG date fallback (
trailing_ifd/metadata_split) still calls the free functions, and the stub test does not cover merge and repairs.