Migrated to new std::path.
This commit is contained in:
parent
92503082bd
commit
1425bc1327
2 changed files with 3 additions and 2 deletions
|
@ -6,6 +6,7 @@ use std::error::Error as StdError;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
use std::io::{Error, ErrorKind, Result};
|
use std::io::{Error, ErrorKind, Result};
|
||||||
|
use std::path::Path;
|
||||||
use rustc_serialize::json::decode;
|
use rustc_serialize::json::decode;
|
||||||
|
|
||||||
/// Configuration data.
|
/// Configuration data.
|
||||||
|
@ -65,7 +66,7 @@ pub struct Config {
|
||||||
impl Config {
|
impl Config {
|
||||||
/// Loads a JSON configuration from the desired path.
|
/// Loads a JSON configuration from the desired path.
|
||||||
#[stable]
|
#[stable]
|
||||||
pub fn load(path: Path) -> Result<Config> {
|
pub fn load(path: &Path) -> Result<Config> {
|
||||||
let mut file = try!(File::open(&path));
|
let mut file = try!(File::open(&path));
|
||||||
let mut data = String::new();
|
let mut data = String::new();
|
||||||
try!(file.read_to_string(&mut data));
|
try!(file.read_to_string(&mut data));
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#![unstable]
|
#![unstable]
|
||||||
#![warn(missing_docs)]
|
#![warn(missing_docs)]
|
||||||
|
|
||||||
#![feature(collections, core, fs, io, net, old_path)]
|
#![feature(collections, core, io, net, path)]
|
||||||
#[cfg(feature = "ctcp")] extern crate time;
|
#[cfg(feature = "ctcp")] extern crate time;
|
||||||
#[cfg(feature = "encode")] extern crate encoding;
|
#[cfg(feature = "encode")] extern crate encoding;
|
||||||
extern crate "rustc-serialize" as rustc_serialize;
|
extern crate "rustc-serialize" as rustc_serialize;
|
||||||
|
|
Loading…
Add table
Reference in a new issue