File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -104,6 +104,14 @@ struct PlotContext {
104104 intrinsic_size : Option < IntrinsicSize > ,
105105}
106106
107+ /// Graphics device state: plot recording, rendering, and comm management.
108+ ///
109+ /// Fields use `Cell`/`RefCell` for interior mutability because the R graphics
110+ /// device callbacks are C function pointers that receive `&DeviceContext` (via
111+ /// `Console::get().device_context()`). There is no way to thread `&mut` through
112+ /// R's callback registration layer. A future refactor could wrap the C-to-Rust
113+ /// bridge so that the Rust-facing hook methods receive `&mut self` explicitly,
114+ /// containing the `Console::get()` unsoundness in one place.
107115pub ( crate ) struct DeviceContext {
108116 /// Channel for sending [IOPubMessage::DisplayData] and
109117 /// [IOPubMessage::UpdateDisplayData] to Jupyter frontends when plot events occur
You can’t perform that action at this time.
0 commit comments