Expose error_code so consumers can read a code instead of parsing one

io_error_code was private, so the predicates built on it (is_halt,
is_skippable_title_stub, is_disc_level_no_key) were the only way to ask
anything about an io::Error's origin. A consumer that needs the code
itself — to report WHY a title failed rather than to branch on one of
three known cases — had no route to it: mux_stream returns an io::Error,
the typed Error is gone by then, and only the E<code> string prefix
survives.

That left every front-end to re-implement the prefix parse by hand,
which is precisely the string-matching 1.5.x spent its time removing.
One parser, exported.

No behaviour change: the function is unchanged and the three predicates
still call it.
This commit is contained in:
Matthew Jackson
2026-07-31 14:46:39 -07:00
parent e9811a1e01
commit d50a7173ad
3 changed files with 16 additions and 6 deletions
+3 -1
View File
@@ -156,7 +156,9 @@ pub use session::{
// All fallible APIs return `Result<T, Error>`. `Error` is a typed enum with a
// numeric `code()`; **no English text in the library** — applications map
// codes to localized messages. See `error.rs` for the full taxonomy.
pub use error::{Error, Result, is_disc_level_no_key, is_halt, is_skippable_title_stub};
pub use error::{
Error, Result, error_code, is_disc_level_no_key, is_halt, is_skippable_title_stub,
};
// ─── Cooperative cancellation ───────────────────────────────────────────────
//