Skip to content

feat: type-safe, idiomatic Rust API (closes #20)#34

Open
MavenRain wants to merge 1 commit intoitzmeanjan:mainfrom
MavenRain:feat/type-safe-idiomatic-api
Open

feat: type-safe, idiomatic Rust API (closes #20)#34
MavenRain wants to merge 1 commit intoitzmeanjan:mainfrom
MavenRain:feat/type-safe-idiomatic-api

Conversation

@MavenRain
Copy link
Copy Markdown

Introduce PieceCount and PieceByteLen newtypes to prevent parameter swapping at call sites. Drop get_ prefixes on all getters per Rust API guidelines. Rename get_decoded_data to into_decoded_data to follow the consuming-method convention. Remove error variants made impossible by the new types (PieceLengthZero, PieceLengthTooShort). Decoder::new is now infallible since the newtypes guarantee non-zero inputs.

  Introduce PieceCount and PieceByteLen newtypes to prevent parameter
  swapping at call sites. Drop get_ prefixes on all getters per Rust API
  guidelines. Rename get_decoded_data to into_decoded_data to follow the
  consuming-method convention. Remove error variants made impossible by
  the new types (PieceLengthZero, PieceLengthTooShort). Decoder::new is
  now infallible since the newtypes guarantee non-zero inputs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant