brik 0.10.0

HTML tree manipulation library - a building block for HTML parsing and manipulation
Documentation
//! Example demonstrating that node dropping doesn't cause stack overflow with deep trees.

#![allow(clippy::print_stdout)]

fn main() {
    let mut depth = 2;
    // 20 M nodes is a few GB of memory.
    while depth <= 20_000_000 {
        let mut node = brik::NodeRef::new_text("");
        for _ in 0..depth {
            let parent = brik::NodeRef::new_text("");
            parent.append(node);
            node = parent;
        }

        println!("Trying to drop {depth} nodes...");
        // Without an explicit `impl Drop for Node`,
        // depth = 20_000 causes "thread '<main>' has overflowed its stack"
        // on my machine (Linux x86_64).
        ::std::mem::drop(node);

        depth *= 10;
    }
}