RustyGet docs · rewrite in progress
Source

rustyget::docs::rust_port

Reference

Rust port status

RustyGet replaces NZBGet's C++ with Rust one module at a time, while the program stays in daily use. Each step keeps the behavior the same, so the rewrite never trades correctness for progress. Almost all of it is done.

How the port works

The Rust code lives in rust/ as a library crate, nzbget_rs, that links into the rustyget binary. The remaining C++ calls it through the C interface declared in rust/include/nzbget_rs.h. Module by module, the program moved behind that interface, and today the C++ is little more than glue.

  1. Pick a module. Hot paths first, measured with real downloads. Whole modules are preferred over single functions.
  2. Port it faithfully. The Rust code reproduces the old behavior, quirks included.
  3. Prove it. While the C++ still existed, differential tests ran the old C++ and the new Rust side by side on the same inputs. Those inputs included random and mutated data. Some of those harnesses remain in the crate's `tests` folder.
  4. Review it. Each port is a pull request with an automated review, fixed until it's clean.
  5. Ship it. The port lands as one signed commit and goes into daily use.

When a port finds a bug in the old code, the port keeps the bug, and the fix follows as a separate commit. Bugs found this way include an error message that glibc left empty, and a RAR header parser that kept going on a block that doesn't advance. New features, such as twin detection, exist only in Rust.

What's left

On the main branch, about 222,000 lines of Rust in rust/src/ do the work. What remains in C++:

Code Lines What it is
daemon/main/rustyget.cpp 308 The program entry point, which hands over to Rust
daemon/util/Util.h 4,460 Glue: the C++ classes and callbacks that still wrap Rust objects
rust/include/*.h 462 C declarations of the Rust interface
tests/ 772 The daemon test runner and its test suites
rust/tests/*.cpp Differential and ownership test harnesses

So the build still needs a C++20 compiler. Several dependencies are already gone, among them CMake, Boost, PAR2-Turbo, libxml2, zlib, ncurses, and the external unrar and 7z programs. The binary links OpenSSL for TLS, and the Rust zstd crate builds the C zstd library. The macOS app in platforms/macos/ is Objective-C.

The detailed inventories in the repository, the migration status, the caller boundary map, and the dependency retirement audit, date from before most of the C++ was removed, so they list far more open work than remains.

Modules in Rust

This table is generated from the crate's source on every build. Each module's first doc comment says what it does. The ffi module is the C interface that the C++ code calls.

Module What it does Lines
allocation_probe Test-only thread-local allocation observation, matching the existing renameanalyzer allocation fixture. 58
articledl Full Rust runtime backing MemoryMonitor, ArticleCache, ArticleWriter, RenameContentAnalyzer, and ArticleDownloader. 3,672
articlefetcher Native Rust implementation of ArticleFetcher, ArticleBatchFetcher pool, TwinCheck::FetchEntry, and in-memory donor NZB parsing (ParseDonorNzb). 1,324
artwritercore Rust domain logic for ArticleWriter, ArticleCache, and MemoryMonitor (daemon/nntp/ArticleWriter.cpp). 1,908
binrpc The binary remote protocol's frame (BinRpc.cpp): the checks BinRpcProcessor makes on a request's base - credentials compared as the C++ strcmp compared them, the request type, its size - the request… 4,872
bytes Pure-Rust byte searches. 58
cleanup End-to-end Rust implementations of: - MoveController (daemon/postprocess/Cleanup.cpp): recursive post-download directory move with collision renaming, cross-device fallback, and stale hardlink… 2,405
cmdline CommandLineParser (CommandLineParser.cpp): the command line as the C++ read it - getopt_long (or getopt) over the same argv array, which it permutes, with the switches that read their own extra… 2,073
collection CollectionAnalyzer: what a download's files are (main video or book, sample, subtitles, NFOs, others; an ambiguous collection or a disc structure) and how to rename them to the release name. 383
configfile The main configuration file reader/writer (ScriptConfig): load, merge-save with the TLS cipher baseline check, and atomic cipher patching. 1,477
crc CRC-32 combination (Crc32::Combine): the CRC of A followed by B from the CRCs of A and B and the length of B. 130
deadpostings End-to-end Rust implementation of DeadPostings (daemon/dupesearch/DeadPostings.cpp): persisted dead-posting line parsing, TTL/clock-skew pruning, sketch matching, and atomic state-file… 552
decode Decoders for RPC requests (WebUtil::DecodeBase64, ...). 319
decoder The article decoder (Decoder): finds yEnc or UU-encoded data in an article as it arrives in pieces, decodes it into the caller's buffer and checks it (sizes, CRC). 1,458
deobfuscation Deobfuscation: the file name in a usenet subject (Deobfuscate) and whether a file name looks like an obfuscated hash (IsExcessivelyObfuscated). 958
directrenamer End-to-end Rust implementation of DirectRenamer (daemon/queue/DirectRenamer.cpp): regular and par2 file renaming (regular_name, par_name, par_name_formatted), par2 set rename check… 1,012
diskstate_format DiskState record serialization and helpers (daemon/queue/DiskState.cpp). 9,059
donorkind Which copy of a release goes first in a fleet, and which duplicate is asked first for missing data: TWINs (byte-identical postings, their articles swap one for one), then ALTs whose packaging stream… 445
donorscore DonorScore: the DupeScore offsets of duplicates (donors and backups) under a pick, as daemon/dupesearch/DonorScore.cpp gave them. 171
downloadinfo End-to-end Rust implementation of DownloadInfo, NzbInfo, FileInfo, CompletedFile, ServerStatList, and ScriptStatusList (daemon/queue/DownloadInfo.cpp). 890
dupecoord End-to-end Rust implementation of DupeCoordinator (daemon/queue/DupeCoordinator.cpp): duplicate name/key matching (same_name_or_key), on-disk verification (files_on_disk), failover threshold… 2,401
dupefallback Hot-path Rust implementations for duplicate article fallback (DupeArticleFallback), PAR2 block-damage estimation (ParDamage), early dead-posting probing (DupeProbe), NNTP server pool level… 5,326
dupeidentity Identity and conservative admission policy for a bounded, decoded first article. 475
dupeprobe End-to-end Rust implementation of DupeProbe (daemon/queue/DupeProbe.cpp): even-spread sample indexing (sample_indexes), NNTP STAT reply classification (classify), dead-posting verdict… 933
dupepurge Owned preflight planning only. 1,121
dupesearch_coord Native Rust coordinator for DupeSearch, Fleet, HttpGet, Newznab::Search, and NntpHealthServer, replacing DonorHealth, ReleaseName, DupeUtil, NzbSummary, NzbReader, HttpGet… 5,650
dupesearch_nzb Terminal unquoted filename parsing and PAR classification for duplicate search. 5,882
dupewatch Pure queue/history discovery policy. 895
entrypoint Rust daemon entrypoint and pre-flight CLI routing (Milestone M5 — Requirement R2 & R4). 214
escape JSON and XML string escaping for RPC responses (WebUtil::JsonEncode, WebUtil::XmlEncode). 172
feed End-to-end Rust implementation of daemon/feed/ (FeedInfo, FeedItemInfo, FeedFile, NzbInfoCreator, and FeedCoordinator). 3,380
feedfilter FeedFilter: the RSS feed filter language (rules separated by '%', each an optional command such as "A(options):" or "R:", then terms joined by spaces, braces and '|'). 1,112
ffi C ABI. 7,329
filetypes FileTypes: file and directory names and contents classified (archives, parity, video, audio, subtitles, books, images, disc structures, samples, clutter) and a file's type sniffed from its first… 717
fsdelete FileSystem's deletes and backup renames (FileSystem.cpp, POSIX): DeleteDirectory (a folder that is empty or holds only hidden files, its empty subfolders removed), DeleteDirectoryWithContent… 516
fsops FileSystem's file operations (FileSystem.cpp, POSIX): FileExists, DirectoryExists, ForceDirectories, MakeUniqueFilename and ExpandHomePath, and the error text of GetLastErrorMessage. 1,899
historycoord HistoryCoordinator (daemon/queue/HistoryCoordinator.cpp) end-to-end Rust implementation. 3,721
jobthread Threads for post-processing jobs, direct unpack, live repair and the pre/post-processor loop. 410
json boost::json::parse with the default parse_options (Json::Deserialize in daemon/util/Json.cpp): strict RFC 8259 (no comments, trailing commas, NaN/Infinity or invalid UTF-8/UTF-16), at most 32 nested… 745
lifecycle Subsystem lifecycle coordination and phase state machine (Milestone M5 — Requirement R2). 2,599
liveparlog The "Live par2 for ..." progress line printed while a direct unpack waits for repair. 208
log Stateful Rust log engine (NzbgetRsLog) backing Log (daemon/util/Log.h / Log.cpp) and CommandScriptLog. 882
maintenance Self-update support (Maintenance: check for updates, run the update script, verify package signatures). 1,411
memory_pressure Low-Memory & OOM Resilience Monitor (Requirement R8). 987
ncurses_format Formatting routines for NCursesFrontend (daemon/frontend/NCursesFrontend.cpp): status bar, top header with uptime/download-time suffix, file queue header and rows, and group queue header, column… 3,076
net Stateful networking, NNTP session, HTTP downloader, and RPC listener/processor runtime (Connection, CancelRegistry, NntpConnection, WebDownloader, RemoteServer, and… 4,284
nntp NntpConnection's protocol (NntpConnection.cpp): a request with the re-login a 480 answer asks for, the AUTHINFO USER/PASS exchange, the greeting on connect and changing the group, as the C++ did them. 2,257
nserv Test NNTP server (daemon/nserv/) subsystems: - YEncoder (daemon/nserv/YEncoder.cpp): yEnc segment validation, file reading, line wrapping, escaping, dot-stuffing, and CRC32 calculation. 2,318
nzbfile End-to-end Rust implementation of NzbFile (daemon/queue/NzbFile.cpp): XML SAX state machine (NzbFileParser), segment ordering and declared-tail detection (declared_parts, declared_tail… 2,293
options Options' value parsers (Options.cpp): ParseTime and ParseWeekDays (the scheduler's task times), ValidateOptionName's classification of option names, ConvertOldOption's renames, HasScript and… 5,394
parchecker End-to-end Rust implementation of ParChecker (daemon/postprocess/ParChecker.cpp) and live repair-while-downloading powered by par-rs. 2,390
pardamage End-to-end Rust implementations of: - ParDamage (daemon/queue/ParDamage.cpp): per-download PAR2 block damage tracking, recovery block counting, and early failure projection. 1,046
parparser Par2 filename parsing and collection matching: - parse_par_filename: returns Some((base_name_len, block_count)) for a .par2 file name (where block_count is 0 for a base .par2 index file… 163
parrenamer ParRenamer::Execute (daemon/postprocess/ParRenamer.cpp): par-rename - the destination directory and its subdirectories walked, par2 files found by their packet header and renamed to… 1,239
paths FileSystem's path text functions: NormalizePathSeparators, BaseFileName, SplitPathAndFilename, ReservedChar, MakeValidFilename, SanitizePathSegment, SanitizeRelativePath, ExtractFilePathFromCmd and… 201
posting Posting (daemon/dupesearch/Posting.cpp): which search results are one posting, the order to fetch postings in, and sketches of postings' articles (including sketch_of_file and its mtime+size cache). 348
postproc End-to-end Rust orchestration for post-processing controllers: ParChecker, UnpackController, DirectUnpack, MoveController, CleanupController, RenameController, and PostRenamerController. 6,780
postrepair Rust hot-path port for DupeCoordinator, DupeMatcher, StreamCrypto, RepairController, ParChecker, DirectUnpack, and UnpackController. 827
prepost End-to-end Rust implementation of PrePostProcessor (daemon/postprocess/PrePostProcessor.cpp). 2,450
procrun Child process execution (ScriptController) for the update scripts and the scheduler Process command. 1,575
progressive_unpack RAR extraction through zipfast's progressive session. 1,487
purgejournal Version-one durable purge registry. 2,915
queuecoord Rust implementation of QueueCoordinator (daemon/queue/QueueCoordinator.cpp). 5,438
queueeditor QueueEditor and GroupSorter (daemon/queue/QueueEditor.cpp) end-to-end Rust implementation. 1,573
queuesubsys_host Shared host callback wrapper for DupeArticleFallback, DupeCoordinator, and QueueCoordinator orchestration in Rust. 5,988
rarreader RarVolume's header parsing (RarReader.cpp): the RAR3 and RAR5 block structure of one volume - its version, naming and volume flags, and the files it holds with their sizes, times, split flags… 1,633
rarrenamer RarRenamer's renaming (RarRenamer.cpp, RenameFiles and what it uses): the rar volumes of a directory gathered into complete sets (MakeSets), the sets not properly named (IsSetProperlyNamed) renamed… 946
releasename ReleaseName (daemon/dupesearch/ReleaseName.cpp): release names as indexers list them, parsed into the attributes the duplicate search compares. 1,045
renameanalyzer DirectRenamer's RenameContentAnalyzer (DirectRenamer.cpp): the first bytes of a downloaded file - whether it starts with a PAR2 packet (and its set id) and the MD5 of its first 16 KiB - fed article… 279
repair End-to-end Rust implementation of RepairController (daemon/postprocess/Repair.cpp). 2,138
rpcparams XmlCommand's request parameter parsing (XmlRpc.cpp): PrepareParams and NextParamAsInt/Bool/Str over the request buffer, as the C++ did it: GET query strings, JSON-RPC and XML-RPC, parsing in place… 728
rpcroute XmlRpcProcessor's request routing and response envelope (XmlRpc.cpp): the protocol from the URL (Execute), the method name, where the parameters start and the JSON request id (Dispatch), and the text… 333
scanner Scanner (daemon/queue/Scanner.cpp) end-to-end Rust implementation. 2,390
scheduler Scheduler::CheckTasks' timing: which scheduled tasks are due between the last check and now (local time), day by day over the check interval, with the startup tasks and the reset after a clock jump. 1,811
sevenzraw Borrowing bytes from a 7z duplicate whose LZMA2 coder could not compress the data. 574
socket POSIX socket and stream connection operations (daemon/connect/Connection.cpp). 1,716
statmeter ServerVolume's slot arithmetic (StatMeter.cpp): which second, minute, hour and day slot a local time falls in (CalcSlots), and AddStats' clearing of the slots the clock moved past (both ways) before… 2,246
streamcompare Stream-repair identity comparison floor; borrowed C++ ranges keep their ownership. 299
streampatchparts Batched stream-repair donor selection, preserving the endpoint predicate. 250
streamrepair Rust port of hot-path stream repair and container content mapping logic: - DupeStreamRepair: IsStreamEligible, ComputeHoles, TotalSize, IntersectsAny, EstimateDonorRanges… 16,669
streamrepair_coord End-to-end Rust implementation of StreamRepairController (daemon/postprocess/StreamRepair.cpp / daemon/util/Util.h), covering both post-processing stream repair (Run) and download-concurrent… 2,206
sysmetrics Live machine metrics for the Status and Statistics pages. 1,304
systemhealth System health configuration and filesystem validation engine (daemon/systemhealth/). 4,671
text WebUtil's in-place text helpers: XmlDecode, XmlStripTags, XmlRemoveEntities, HttpUnquote, UrlDecode, plus UrlEncode and Latin1ToUtf8. 484
tlssock OpenSSL TLS for news server and web connections, the socket deadline used by TLS cipher probes, and the OpenSSL side of the TLS cipher measurement. 1,918
twin Twins and alts: duplicates of a download told apart by the files their par2 sets describe. 2,768
unpack DirectUnpack (daemon/postprocess/DirectUnpack.cpp) and UnpackController (daemon/postprocess/UnpackController.cpp) end-to-end Rust implementation. 3,709
url URL::ParseUrl: splits "scheme://user:password@host:port/resource". 138
urlcoord End-to-end Rust implementation of UrlCoordinator and UrlDownloader (daemon/queue/UrlCoordinator.cpp): X-DNZB header parsing (dnzb_header), next-URL priority selection (select_next_url)… 1,040
util Util's string helpers: FormatSize, FormatSpeed, AlphaNum, HashBJ96, ReduceStr, the Tokenizer's tokens and MatchFileExt. 2,242
webdownload WebDownloader's HTTP decisions (WebDownloader.cpp): the status line (CheckResponse), the response headers it acts on (ProcessHeader) and the URL a redirect leads to (ParseRedirect). 1,421
webserver The web server's request handling decisions (WebProcessor): what a request header line means, the URL's prefix and credentials, the credential check and the authorized-IP list. 1,433
webutil WebUtil's tag and field finders and ParseContentDispositionFilename, matching the C++ code byte for byte, quirks included. 223
wildmask Wildcard matching (WildMask): * any run, ? any byte, # one digit; letters compare case-insensitively through a table supplied by the C++ caller for its current locale. 247
xmlrpc_format XML-RPC and JSON-RPC response serialization and command routing (daemon/remote/XmlRpc.cpp). 7,832

Porting notes

The notes below come from rust/PORTING.md in the repository. They were written during the first ports, when the Rust code built through CMake and every C++ routine stayed as a fallback, so their rules describe that stage. Their table of finished ports lists the measured speed-ups; the module table on this page lists all current Rust modules.

nzbget moves to Rust one routine at a time. The Rust code lives in rust/ and builds as a static library (cmake/rust.cmake). C++ calls it through the C ABI in rust/include/nzbget_rs.h.

Rules

  • Each port matches the C++ output byte for byte, quirks included. A behavior change is a separate commit.
  • Before each swap, a differential fuzz runs the old C++ against the Rust code. The C++ version remains as a fallback for platforms without Rust integration.
  • Measure before and after; port the hot paths first.

Done

C++ Rust Speed-up
WebUtil::JsonEncode escape::json_encode 1.9x
WebUtil::XmlEncode escape::xml_encode 1.6x
WildMask::Match wildmask::wild_match 1.4x
WebUtil::DecodeBase64 decode::base64_in_place 3.2x
WebUtil::JsonNextValue decode::json_next_value 4.5x
WebUtil::JsonDecode decode::json_decode 2.3x
Crc32::Combine crc::combine 135x
WebUtil::XmlDecode, XmlStripTags, XmlRemoveEntities, HttpUnquote, UrlDecode, UrlEncode, Latin1ToUtf8 text port only
WebProcessor header, URL, credential and IP checks webserver port only
Decoder (yEnc, UU, raw; rapidyenc kept) decoder parity
Scheduler::CheckTasks timing (tasks run in C++) scheduler port only
XmlCommand request parameters (PrepareParams, NextParamAsInt/Bool/Str) rpcparams port only
XmlRpcProcessor routing (Execute protocol, Dispatch method/id/params) and BuildResponse envelope rpcroute port only
Util::SplitCommandLine, Trim*, SanitizeLine, EndsWith, FormatBuffer, WebUtil::ParseRfc822DateTime util port only
ServerVolume::CalcSlots and AddStats slot clearing (StatMeter) statmeter port only
Options::ParseTime, ParseWeekDays, ValidateOptionName, ConvertOldOption, ParseCategorySource options port only
WebDownloader::CheckResponse, ProcessHeader, ParseRedirect webdownload port only
UrlDownloader::ProcessHeader (X-DNZB headers), UrlCoordinator::UrlCompleted statuses urlcoord port only
NntpConnection protocol: Request (480 re-login), AUTHINFO USER/PASS, the greeting, GROUP (C++ does the I/O) nntp port only
CommandLineParser (getopt over the same argv, the file argument, ID and name lists) cmdline port only
FileSystem::FileExists, DirectoryExists, ForceDirectories, MakeUniqueFilename, ExpandHomePath, GetLastErrorMessage (fixed: XSI strerror_r) fsops port only
ParParser::ParseParFilename, SameParCollection parparser port only
RarVolume header parsing (RAR3/RAR5 blocks, files, encryption records; the source and OpenSSL stay C++) rarreader port only
RarRenamer::RenameFiles (sets, proper names, main file, new names; the regex, file checks and moves stay C++) rarrenamer port only
DirectRenamer's RenameContentAnalyzer (PAR2 header and set id, MD5 of the first 16 KiB) renameanalyzer port only
DirectRenamer's new names (BuildNewRegularName, BuildNewParName, NeedRenamePars) directrenamer port only
TestServerXmlCommand's JSON body (Json::Deserialize, ParseRequestParams: value_tostd::string/int/bool) rpcparams, json port only
ParRenamer::Execute (par-rename: par2 files by header and set id, regular files by the MD5 of their first 16 KiB, .bad par2 files, missing files; par2 loading, file IO and moves stay C++) parrenamer port only
FileSystem::DeleteDirectory, DeleteDirectoryWithContent, RenameBak, GetFileExtension (links never followed, first error kept, errno as before; the file system calls stay C++) fsdelete port only
BinRpc's frame (BinRpcProcessor::Execute credential check, request names, Dispatch size check, SendBoolResponse, ReceiveTrailing length check), list responses (List, Log, PostQueue, History: the C++ collects a response's entries under its locks into plain structs, one call encodes them into caller scratch or one owned allocation), EditQueue's trailing data (size check, ids, names), Download's URL test, and the remote client's reading of list responses (RemoteClient: the existing single-entry queue reader, the log, post-queue and history listings printed from one call each) binrpc port; the client stops at an entry that doesn't fit the data, unknown stages and statuses print no text; entry fields a kind doesn't set are 0, a negative Log line count asks for no entries
NzbFile::AddFileInfo (segments in part order, the declared parts and tail, sizes), DeclaredParts, HasDuplicateFilenames (one pass instead of every pair); the XML handlers, the queue objects and the filenames stay C++ nzbfile 17x at 20,000 files
DonorScore::Base, Target, Rerank (duplicate scores under a pick; Ranks stays C++ and calls Target) donorscore 1.2x
ReleaseName::Clean, Normalize, ShortQuery, Parse, Readable, SameRelease (the std::regex patterns matched by hand in the engine's order; C ctype as nzbget sets it) releasename 2.6x
Posting::MakeSketch, SameSketch, SamePosting, GroupListings, ListingMismatch, OrderPostings (CRC-32, stable ordering and first matching listing's rank; file reading and its cache stay C++) posting 2.3x ordering

Each port has a differential test in rust/tests/ that compares it with the pre-port C++ under ASan and UBSan.

Each port adds representative Rust kernel coverage to rust/benches/ports.rs or the selective development-only Criterion pilot. Kernel results support attribution and regression history; they do not qualify a runtime replacement.

Before each replacement, the PR shows matched complete C++/current-Rust/candidate caller timings and percentage changes for every representative fixture, with raw samples, verified observable output, immutable source/compiler/binary/input hashes and reproduction instructions. Include the real external C++/FFI call boundaries, allocation, mutable input clone/reset and ownership/destruction costs. Retain original and stronger optimized C++ controls, slower rows, unchanged-control drift and layout/host uncertainty. The replacement must be independently faster than the C++ it replaces and preserve existing Rust caller performance where already ported. Missing or inconclusive complete-caller evidence is HOLD; rework or hold/split slower functions instead of advancing a broad patch.

Bencher's inherited 10% historical regression alert is monitoring only, never a migration waiver. Passing that alert is not proof that a replacement is faster. The historical figures above describe their recorded fixtures, not standing approval for later changes. New shared qualification defaults apply prospectively; partial legacy archives retain unknown fields and raw rows rather than inventing native v1 evidence.

See rust/benches/README.md for the shared remote runner, resource-lock order, schema, whole-process paired statistics, Criterion limits, data-only trusted publication and verified xbmc4lyfe identity. Current Bencher configuration is absent and publication ready=false; workflow definitions or a signed evidence commit alone do not establish activation or attest a measurement.

Native duplicate discovery

dupeidentity reads bounded RAR4/RAR5 first-article headers or a bare media file's yEnc size. It rejects samples, unknown sizes, encrypted headers and conflicting release names. The daemon retains article transport and queue ownership. DupeSameSize hints compare data-file counts and bytes independently of parity overhead; existing and newly discovered backups use the same rule. The hints select candidates for the existing checksum validation, rather than establishing byte identity.

dupewatch owns queue/history eligibility, repeat-search suppression, broader queries, a shared atomic fetch budget, partial-NZB health normalization and PAR2 repairability estimates. The daemon retains queue locks, HTTP/NNTP transport and the existing failover controller. A search shares one deadline and a budget of three HTTP attempts per configured donor across strict and broader passes; zero keeps the existing unlimited mode. Broader candidates need conservative release compatibility and matching decoded packed-media identity. Generated duplicate keys follow renamed picks only when the persisted per-NZB ownership marker matches; client key edits clear that marker. Explicit client keys remain intact. Empty searches can retry without losing the title needed to recognize generated keys, while a usable existing backup suppresses those retries.

The offline differential test compares the pure Python proxy reference with Rust. It deliberately never imports proxy configuration or performs indexer requests. The watcher differential suite likewise runs only local pure-function fixtures. Isolated fake NNTP/Newznab functional scenarios exercise broader identity proof, data-only hints and rename tracking. The Bencher suite includes identity, queue decisions, broader queries and partial health normalization.

The source-extracted pre-port Prepare prefix matches 184,320 C++ ASan/UBSan fixtures. A separate same-feature C++ control performs the required identity, cache, ownership, fleet and history work with the faithful pre-port C++ normalizer and an independent allocation-free policy. This control is a counterfactual implementation, not the old production controller. Parity checks cover normalization, signed-time extremes, ownership and active/retired fleets.

Decision-prefix measurements include normalization, runtime name-cache work, peer/history snapshots, allocation and the real Rust C ABI. Both callers stop before accepted-search stamp writes, edits, saving, packed-media proof and transport. Cold/restart and warm eligible/cooldown fixtures are measured under the exclusive shared-worker lock. Prebuilt snapshots separately compare the best direct C++ policy with Rust; a second opaque C++ translation-unit experiment makes the ABI boundary comparable. Generic lower-score peer snapshots are valid API stress cases, while the production caller normally filters those peers before the call. These are synthetic fixtures, not deployment measurements.

Earlier comparisons against the old production controller perform different work and are retained only as historical experiments. The context-bearing old C++ policy prefix and the scalar Rust function also have different boundaries; their timings do not establish a language speedup. Wrapper experiments are kept separate from the best direct C++ control. Final gates use paired changes for each row and retain slower and noisy results.

Later complete PrepareNative measurements use the actual native library, metadata, collection, logging and isolated state/progress writes. The alternative C++ controller changes only watch/normalization boundaries; existing SameRelease remains shared production behavior. Tiny (2 live/0 history), normal (4/2) and large (128/1024) fixtures pass 28 parity cases, including generated-key cold/warm writes. Ordinary optimized C++ policy remains machine-outlined; no control is handicapped. Five alternating process pairs preserve every sample. A second fixed experiment removes backend-specific normalization from untimed fixture resets/assertions and uses a new composed archive; differences cannot be attributed to that repair alone. Its paired medians still show tiny warm IO +4.97%, generated warm IO +4.44% and large warm IO +1.94%. The candidate remains held; no overall faster claim follows. Matched IO bytes do not independently prove every atomic write or fsync succeeded. Full raw process pairs and compiler/source provenance are retained in PR #80.

Restarted searches bind donor proof to the original title, key and posting fingerprint; changed/unbound saved state is searched again. Legacy three-field stamps refresh once and preserve ambiguous client keys; only an independently persisted per-NZB marker proves generated ownership. Manual name edits notify only the watcher. Inferred absent parts mark unusable donors dead, including fast additions and existing history members. Generated keys and managed score floors persist without client edits.

Parked

  • NZB parsing (NzbFile::Parse, libxml2 SAX1): a Rust parser that matches libxml2's callbacks exactly. All 5,929 NZBs on the test server plus 9,000 mutated documents match or are left to libxml2. It is still about 25% slower than libxml2 on a 17.6 MB NZB, so it is not merged.

Next

Track remaining application areas, native dependencies, external helpers, platforms, qualification, and final C++ removal in the zero C++ checklist. Its source is site/content/rust-port.md. The generated module table lists existing Rust modules, not a complete application migration.

The C++ fallbacks remain required during migration. Removing them requires qualified Rust paths for every retained target and the final removal checks; porting the routines in the Done table doesn't retire the C++ application.

Build and verification

Native POSIX builds use Rust when Cargo, rustc, and the target standard library are available; otherwise they retain the C++ encoders. Debug selects Cargo's dev profile; other CMake configurations select release. Cargo is invoked on each build to track its own sources, lockfile, build scripts, and configuration. Both the daemon and test executable inherit the archive and Rust's native link dependencies. Static executable builds select Rust's static CRT dependencies as well.

Non-macOS cross builds keep C++ unless a matching target is provided with -DNZBGET_RUST_TARGET=<triple>. macOS selects the target from the CMake architecture and forwards CMAKE_OSX_DEPLOYMENT_TARGET. Install the Rust standard library for the chosen target to enable Rust for that architecture. An explicit NZBGET_RUST_TARGET requires a working Rust toolchain and standard library; a missing dependency is an error rather than an automatic fallback.

Run cargo test --release in rust/ for encoder and FFI tests. On POSIX with a C++ compiler supporting ASan/UBSan, run python3 rust/tests/differential.py from the repository root for a deterministic comparison against the exact encoder bodies in commit 78dcb938. This covers arbitrary bytes, embedded NULs, invalid continuations, truncations, and out-of-range code points.