Skip to content

Conversation

absporl
Copy link

@absporl absporl commented Jun 4, 2025

This allows implementations of Serialize to change behavior depending on the encoding method used (e.g. encode as base64 for human readable encodings such as JSON, and encode as binary strings for bencode).

This allows implementations of Serialize to change behavior depending on the encoding method used (e.g. encode as base64 for human readable encodings such as JSON, and encode as binary strings for bencode).
@josecelano josecelano requested a review from Copilot June 4, 2025 16:04
@josecelano
Copy link
Collaborator

ACK 77aca38

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces an implementation of is_human_readable for the bencode Serializer, ensuring it always reports non–human-readable output.

  • Added fn is_human_readable(&self) -> bool { false } to ser::Serializer impl for &mut Serializer
Comments suppressed due to low confidence (2)

src/ser.rs:216

  • Consider adding a doc comment for is_human_readable to explain that this serializer always returns false to enforce binary encodings (e.g., for bencode).
fn is_human_readable(&self) -> bool {

src/ser.rs:216

  • Add a unit test to verify that is_human_readable() returns false and that serialization branches correctly for non–human-readable formats.
fn is_human_readable(&self) -> bool {

@josecelano
Copy link
Collaborator

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.

2 participants