<commit_before>use std::ffi::{CString, CStr};
use std::marker::PhantomData;
use std::path::Path;
use std::ptr;

use libc::c_char;

use openexr_sys::*;

use error::*;
use frame_buffer::FrameBuffer;
use Header;


#[allow(dead_code)]
pub struct InputFile<'a> {
    handle: *mut CEXR_InputFile,
    header_ref: Header,
    istream: Option<IStream<'a>>,
    _phantom: PhantomData<CEXR_InputFile>,
}

impl<'a> InputFile<'a> {
    pub fn new(path: &Path) -> Result<InputFile<'static>> {
        let c_path = CString::new(path.to_str()
                                      .expect("non-unicode path handling is unimplemented")
                                      .as_bytes())
                .unwrap();
        let mut error_out = ptr::null();
        let mut out = ptr::null_mut();<commit_msg>Add doc example to `InputFile`<commit_after>use std::ffi::{CString, CStr};
use std::marker::PhantomData;
use std::path::Path;
use std::ptr;

use libc::c_char;

use openexr_sys::*;

use error::*;
use frame_buffer::FrameBuffer;
use Header;

/// Common input interface for all types of OpenEXR files
///
/// # Examples
/// ```rust,no_run
/// # use openexr::{InputFile, FrameBuffer};
/// # use std::path::Path;
/// # let path = "/path/to/file.exr";
/// # let path = Path::new(&path);
/// let file = InputFile::new(path).unwrap();
/// let window = file.header().data_window();
/// let width = window.max.x - window.min.x + 1;
/// let height = window.max.y - window.min.y + 1;
///
/// let mut pixel_data: Vec<[f32; 4]> = vec![[0.0, 0.0, 0.0, 0.0]; (width*height) as usize];
/// let mut fb = FrameBuffer::new(width as usize, height as usize);
/// fb.insert_pixels(&[("R", 0.0), ("G", 0.0), ("B", 0.0), ("A", 0.0)], &mut pixel_data);
/// file.read_pixels(&mut fb).unwrap();
/// ```
#[allow(dead_code)]
pub struct InputFile<'a> {
    handle: *mut CEXR_InputFile,
    header_ref: Header,
    istream: Option<IStream<'a>>,
    _phantom: PhantomData<CEXR_InputFile>,
}

impl<'a> InputFile<'a> {
    pub fn new(path: &Path) -> Result<InputFile<'static>> {
        let c_path = CString::new(path.to_str()
                                      .expect("non-unicode path handling is unimplemented")
                                      .as_bytes())
                .unwrap();
        let mut error_out = ptr::null();
        let mut out = ptr::null_mut();
{'fraction_non_alphanumeric': 0.18720480893087163, 'fraction_numerical': 0.009016745384285102, 'mean_word_length': 2.7763371150729337, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4845858', 'n_tokens_mistral': 821, 'n_tokens_neox': 809, 'n_words': 188}