Crate aspmatch[−][src]
Expand description
aspmatch
Parse and write ASP match files
Example
Dump/Parse match as binary.
use tempfile::tempfile;
use std::io::{Write};
use std::io::Seek;
use aspmatch::{IPMatch, dump_match_as_binary, parse_binary_match_file};
// Create a file inside of `std::env::temp_dir()`.
let mut tmpfile = tempfile::tempfile().unwrap();
let ipmatch = IPMatch::default();
// write match as binary to file
dump_match_as_binary(&ipmatch, &mut tmpfile)?;
tmpfile.seek(SeekFrom::Start(0)).unwrap();
// parse match from binary file
let parsed = parse_binary_match_file(&tmpfile)?;
assert_eq!(ipmatch, parsed);
Dump/Parse match as text.
use tempfile::tempfile;
use std::io::{Write};
use std::io::Seek;
use aspmatch::{IPMatch, dump_match_as_text, parse_text_match_file};
// Create a file inside of `std::env::temp_dir()`.
let mut tmpfile = tempfile::tempfile().unwrap();
let ipmatch = IPMatch::default();
// write match as text to file
dump_match_as_text(&ipmatch, &mut tmpfile)?;
tmpfile.seek(SeekFrom::Start(0)).unwrap();
// parse match from text file
let parsed = parse_text_match_file(&tmpfile)?;
assert_eq!(ipmatch, parsed);
Structs
Enums
Custom Error Enum for lib consumption.
Functions
Dump IPMatch as binary
Dump IPMatch to file
Dump IPMatch as binary to file at path
Dump IPMatch as text
Dump IPMatch to file
Dump IPMatch as text to file at path
Parse IPMatch from byte slice assuming little endianness
Parse IPMatch from text assuming little endianness
Parse IPRecord from byte slice assuming little endianness
Parse IPRecord from text assuming
Parse IPMatch from binary file assuming file fits in RAM
Parse IPMatch from binary file at path, assuming file fits in RAM
Parse IPMatch from text file assuming file fits in RAM
Parse IPMatch from text file at path, assuming file fits in RAM