Struct bitflags::__core::fs::File [] [src]

pub struct File {
    // some fields omitted
}
1.0.0
[]

A reference to an open file on the filesystem.

An instance of a File can be read and/or written depending on what options it was opened with. Files also implement Seek to alter the logical cursor that the file contains internally.

Examples

use std::io::prelude::*;
use std::fs::File;

let mut f = try!(File::create("foo.txt"));
try!(f.write_all(b"Hello, world!"));

let mut f = try!(File::open("foo.txt"));
let mut s = String::new();
try!(f.read_to_string(&mut s));
assert_eq!(s, "Hello, world!");