contentious 0.1.0

Contention experiments
Documentation
use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Frame {
    pub file: String,
    pub line: u32,
}

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Backtrace {
    pub frames: Vec<Frame>,
}

impl Backtrace {
    pub fn capture() -> Self {
        let bt = backtrace::Backtrace::new();
        let mut all_frames = Vec::new();

        // First, collect all frames
        for frame in bt.frames() {
            for symbol in frame.symbols() {
                if let Some(filename) = symbol.filename() {
                    if let Some(line) = symbol.lineno() {
                        all_frames.push(Frame {
                            file: filename.to_string_lossy().to_string(),
                            line,
                        });
                    }
                }
            }
        }

        Backtrace { frames: all_frames }
    }

}