From 207dc61af21883901b23b63808353c03c513c1d7 Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 11 Mar 2015 11:16:44 -0500 Subject: [PATCH] Add usage to readme --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index 8c350f8..fceed7c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,18 @@ rust-xdg is a library that makes it easy to follow the standards for directories. +## Usage + +```rust +use xdg::XdgDirs; +use std::fs::File; + +let dirs = XdgDirs::new(); +let data_dir = dirs.want_write_data("AppName"); + +let mut f = File::create(data_dir.join("data.txt")); +f.write(b"Some data.\n"); +``` + ## License rust-xdg is primarily distributed under the terms of both the MIT license