oracal / rust-gumbo

A Rust wrapper around google's c library gumbo.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rust Gumbo

A Rust wrapper around google's c library gumbo.

First and foremost it tries to provide an idiomatic rust api around gumbo. Secondly, it tries to not add much overhead on top of the c library.

Example

extern crate gumbo;
use gumbo::{Parser, Node, Element};

fn dfs(node: &Node) {
    match *node {
        Element(ref element) => {
            for child_node in element.children().iter() {
                dfs(child_node)
            }
        },
        _ => {},
    }
}

let html: String = ...;
let parser = Parser::new();
let output = parser.parse(html.as_slice()).unwrap();
dfs(output.root());

Check out the examples folder for examples that match up to the ones from the c library.

License

MIT

About

A Rust wrapper around google's c library gumbo.


Languages

Language:Rust 100.0%