line_ui/element/cursor.rs
1/*
2 * Copyright (c) 2025 Jasmine Tai. All rights reserved.
3 */
4
5use crate::element::Element;
6use crate::render::RenderChunk;
7
8/// An element that places the cursor at its position.
9#[derive(Debug, Clone, Copy)]
10pub struct Cursor;
11
12impl Element for Cursor {
13 fn width(&self) -> usize {
14 0
15 }
16
17 fn render(&self) -> impl DoubleEndedIterator<Item = RenderChunk<'_>> {
18 std::iter::once(RenderChunk::CURSOR)
19 }
20}