pub fn new(width: usize, height: usize) -> ModelExpand description
Creates a new viewport with the specified dimensions.
This is a convenience function that creates a new viewport instance.
It’s equivalent to calling Model::new(width, height) directly, but
provides a more functional style API that some users may prefer.
§Arguments
width- Display width in charactersheight- Display height in lines
§Returns
A new viewport Model configured with the specified dimensions
§Examples
use bubbletea_widgets::viewport;
// Functional style
let viewport = viewport::new(80, 24);
// Equivalent to:
let viewport = viewport::Model::new(80, 24);§Use Cases
- Functional Style: When preferring function calls over constructors
- Import Convenience: Shorter syntax with
use bubbletea_widgets::viewport::new - API Consistency: Matches the pattern used by other bubbles components