Skip to content

Implement Default for StreamRenderer - #2

Open
Atliac wants to merge 1 commit into
cloudflavor:mainfrom
Atliac:StreamRenderer-default
Open

Implement Default for StreamRenderer#2
Atliac wants to merge 1 commit into
cloudflavor:mainfrom
Atliac:StreamRenderer-default

Conversation

@Atliac

@Atliac Atliac commented Jun 13, 2026

Copy link
Copy Markdown

Implement Default for StreamRenderer

Description

This PR introduces a Default implementation for the StreamRenderer struct, allowing for a more ergonomic initialization process.

Motivation

Previously, creating a StreamRenderer required explicitly providing the terminal width and a ThemeMode. By implementing Default, the renderer can now automatically detect the current terminal width and set the theme to Auto, reducing boilerplate for users who want standard behavior.

Changes

  • src/stream_renderer.rs: Added impl Default for StreamRenderer which initializes the renderer using current_terminal_width() and ThemeMode::Auto.
  • examples/streaming_demo.rs: Updated the example to use StreamRenderer::default() instead of a hardcoded width and theme.

Testing

  • Verified that examples/streaming_demo.rs runs correctly using the new default() initialization.

Provide a default implementation that uses the current terminal width
and automatic theme mode, simplifying the initialization of the
StreamRenderer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant