pub struct RenderOutputRef<'a> {
pub buffer_id: BufferId,
pub spans: &'a [Vec<(usize, usize, StyleSpec)>],
pub signs: Vec<DiagSign>,
pub key: (u64, usize, usize),
pub perf: PerfBreakdown,
}Expand description
Borrowed view of a viewport render result.
Identical to RenderOutput except that spans borrows the layer’s
internal row cache instead of deep-copying it. Renderer adapters convert
the span table into their own style type anyway, so borrowing lets them
build exactly one table per recompute instead of two (the cache copy plus
the converted copy).
The borrow keeps the SyntaxLayer locked for the lifetime of the value —
convert or copy out of it, then drop it. Use
RenderOutputRef::into_owned (or SyntaxLayer::render_viewport) when
an owned table is required.
§Examples
use hjkl_syntax::{PerfBreakdown, RenderOutputRef};
let rows = Vec::new();
let out = RenderOutputRef {
buffer_id: 0,
spans: &rows,
signs: Vec::new(),
key: (0, 0, 0),
perf: PerfBreakdown::default(),
};
assert_eq!(out.into_owned().buffer_id, 0);Fields§
§buffer_id: BufferIdRoutes spans/signs back to the matching buffer slot.
spans: &'a [Vec<(usize, usize, StyleSpec)>]Per-row span table, borrowed from the layer’s viewport cache.
signs: Vec<DiagSign>Diagnostic signs for the gutter.
key: (u64, usize, usize)(dirty_gen, viewport_top, viewport_height) cache key.
perf: PerfBreakdownSub-step timing breakdown (zeroed in fully-sync path).
Implementations§
Source§impl RenderOutputRef<'_>
impl RenderOutputRef<'_>
Sourcepub fn into_owned(self) -> RenderOutput
pub fn into_owned(self) -> RenderOutput
Deep-copy the borrowed span table into an owned RenderOutput.
§Examples
use hjkl_syntax::{PerfBreakdown, RenderOutputRef};
let rows = vec![Vec::new()];
let out = RenderOutputRef {
buffer_id: 3,
spans: &rows,
signs: Vec::new(),
key: (1, 0, 30),
perf: PerfBreakdown::default(),
}
.into_owned();
assert_eq!(out.spans.len(), 1);