Update README adding info about Cargo.toml.

This commit is contained in:
Rafał Harabień 2017-11-08 02:08:07 +01:00
parent ce76c486ec
commit ff93bc3b5f

View File

@ -1,5 +1,5 @@
Rust FAT Rust FAT FS
======== ===========
[![Travis Build Status](https://travis-ci.org/rafalh/rust-fat.svg?branch=master)](https://travis-ci.org/rafalh/rust-fat) [![Travis Build Status](https://travis-ci.org/rafalh/rust-fat.svg?branch=master)](https://travis-ci.org/rafalh/rust-fat)
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE.txt) [![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE.txt)
@ -16,12 +16,23 @@ Features:
* FAT12, FAT16, FAT32 compatibility, * FAT12, FAT16, FAT32 compatibility,
* LFN (Long File Names) extension supported. * LFN (Long File Names) extension supported.
Example Usage
======= -----
let file = File::open("fat.img").unwrap(); Put this in your `Cargo.toml`:
let mut buf_rdr = BufStream::new(file);
let fs = FileSystem::new(&mut buf_rdr, true).unwrap(); [dependencies]
fatfs = "0.1"
Put this in your crate root:
extern crate fatfs;
You can start using library now:
let img_file = File::open("fat.img").unwrap();
let mut buf_stream = BufStream::new(img_file);
let fs = fatfs::FileSystem::new(&mut buf_stream, true).unwrap();
let mut root_dir = fs.root_dir(); let mut root_dir = fs.root_dir();
let mut file = root_dir.create_file("hello.txt").unwrap(); let mut file = root_dir.create_file("hello.txt").unwrap();
file.write_all(b"Hello World!").unwrap(); file.write_all(b"Hello World!").unwrap();