tui_scrollbar/
lengths.rs

1/// Bundle content and viewport lengths to avoid ambiguous arguments.
2///
3/// This struct is a convenience for readability. Use a struct literal so each field is named at
4/// the call site:
5///
6/// ```rust
7/// use tui_scrollbar::ScrollLengths;
8///
9/// let lengths = ScrollLengths {
10///     content_len: 200,
11///     viewport_len: 20,
12/// };
13/// ```
14///
15/// Zero values are accepted, and consumers like [`ScrollBar`] and [`ScrollMetrics`] will treat
16/// them as 1.
17///
18/// [`ScrollBar`]: crate::ScrollBar
19/// [`ScrollMetrics`]: crate::ScrollMetrics
20#[derive(Debug, Clone, Copy, PartialEq, Eq)]
21pub struct ScrollLengths {
22    /// Total scrollable content length in logical units.
23    pub content_len: usize,
24    /// Visible viewport length in logical units.
25    pub viewport_len: usize,
26}