pub struct CanvasStore { /* private fields */ }Expand description
Thread-safe store for canvas state. Shared between the tool and gateway.
Implementations§
Source§impl CanvasStore
impl CanvasStore
Sourcepub async fn list(&self) -> Vec<CanvasSummary>
pub async fn list(&self) -> Vec<CanvasSummary>
List all active canvases.
Sourcepub async fn history(&self, id: &str) -> Option<VecDeque<CanvasFrame>>
pub async fn history(&self, id: &str) -> Option<VecDeque<CanvasFrame>>
Get frame history for a canvas.
Sourcepub async fn render(
&self,
id: &str,
content_type: &str,
content: &str,
) -> Result<()>
pub async fn render( &self, id: &str, content_type: &str, content: &str, ) -> Result<()>
Render content to a canvas.
Creates the canvas if it does not exist. Pushes the previous current frame
into history (capped at MAX_HISTORY_FRAMES) and broadcasts the update.
Returns an error if the content type is not in [ALLOWED_CONTENT_TYPES] or
the content exceeds MAX_CONTENT_BYTES.
Sourcepub async fn clear(&self, id: &str) -> bool
pub async fn clear(&self, id: &str) -> bool
Clear a canvas (remove current content, keep history).
Returns true if the canvas existed, false otherwise.
Sourcepub fn subscribe(&self) -> Receiver<(String, CanvasFrame)>
pub fn subscribe(&self) -> Receiver<(String, CanvasFrame)>
Subscribe to canvas updates (for WebSocket streaming).
Trait Implementations§
Source§impl Clone for CanvasStore
impl Clone for CanvasStore
Source§fn clone(&self) -> CanvasStore
fn clone(&self) -> CanvasStore
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CanvasStore
impl Debug for CanvasStore
Auto Trait Implementations§
impl Freeze for CanvasStore
impl !RefUnwindSafe for CanvasStore
impl Send for CanvasStore
impl Sync for CanvasStore
impl Unpin for CanvasStore
impl UnsafeUnpin for CanvasStore
impl !UnwindSafe for CanvasStore
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