pub struct ContentView {
pub lines: Vec<Line<'static>>,
pub scroll_offset: usize,
pub selected_link: Option<usize>,
pub link_positions: Vec<(usize, usize)>,
/* private fields */
}Expand description
HTML コンテンツを意味的 AST 経由で ratatui Lines に変換し、 スクロールとリンク選択を管理する。
Fields§
§lines: Vec<Line<'static>>§scroll_offset: usize§selected_link: Option<usize>§link_positions: Vec<(usize, usize)>(line_idx, link_idx_in_content_links) — navigate 用
Implementations§
Source§impl ContentView
impl ContentView
Sourcepub fn from_document(doc: &Document, links: &[ExtractedLink]) -> Self
pub fn from_document(doc: &Document, links: &[ExtractedLink]) -> Self
Document と links から直接 ContentView を構築する(フォーマット非依存エントリポイント)
Sourcepub fn from_content(content: &ExtractedContent) -> Self
pub fn from_content(content: &ExtractedContent) -> Self
HTML コンテンツから ContentView を構築する(後方互換ラッパー)
pub fn total_lines(&self) -> usize
pub fn scroll_down(&mut self, n: usize, viewport_height: usize)
pub fn scroll_up(&mut self, n: usize)
pub fn scroll_to_top(&mut self)
pub fn scroll_to_bottom(&mut self, viewport_height: usize)
pub fn next_link(&mut self)
pub fn prev_link(&mut self)
pub fn selected_link_url<'a>( &self, links: &'a [ExtractedLink], ) -> Option<&'a Url>
Auto Trait Implementations§
impl Freeze for ContentView
impl RefUnwindSafe for ContentView
impl Send for ContentView
impl Sync for ContentView
impl Unpin for ContentView
impl UnsafeUnpin for ContentView
impl UnwindSafe for ContentView
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more