Skip to main content

dump_ops

Function dump_ops 

Source
pub fn dump_ops(ops: &Ops) -> Result<()>
Expand description

Dumps all operands and operators of a code.

Returns a Result value, when an error occurs.

§Errors

Propagates any std::io::Error produced by the color-aware writer that backs stdout (broken pipe, write failure, …).

§Examples

use std::path::PathBuf;

use big_code_analysis::{dump_ops, get_ops, LANG};

let source_code = "int a = 42;";
let path = PathBuf::from("foo.c");
let source_as_vec = source_code.as_bytes().to_vec();

// Retrieve all operands and operators via the non-generic
// `get_ops` entry point.
let ops = get_ops(&LANG::Cpp, source_as_vec, &path, None).unwrap();

// Dump all operands and operators
dump_ops(&ops).unwrap();