linear-tui 0.13.0

A TUI client for Linear.app — manage issues, projects, and cycles from your terminal
//! Requests waiting for the main loop, and what is already on its way.

use std::collections::VecDeque;

use crate::core::usecase::Request;

#[derive(Debug, Default)]
pub struct Outbox {
    /// Requests queued by the UI, drained and spawned by the main loop.
    pub requests: VecDeque<Request>,
    /// Number of requests currently in flight.
    pub inflight: usize,
    /// Text the main loop should push to the system clipboard via OSC 52.
    pub clipboard: Option<String>,
    /// A description the main loop should open in `$EDITOR`.
    pub editor: Option<super::EditorJob>,
}

impl Outbox {
    pub fn push(&mut self, req: Request) {
        // Collapse duplicates so a held-down key can't pile up identical fetches.
        if !self.requests.contains(&req) {
            self.requests.push_back(req);
        }
    }
}