Skip to content

Commit

Permalink
Merge pull request #8 from dgriffen/deprecate-iter
Browse files Browse the repository at this point in the history
deprecate `iter` methods
  • Loading branch information
ZoeyR authored May 14, 2019
2 parents 3550ce7 + fe38ac7 commit 1f5658d
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dotenv/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "dotenv"
version = "0.14.0"
version = "0.14.1"
authors = ["Noemi Lapresta <[email protected]>", "Craig Hills <[email protected]>", "Mike Piccolo <[email protected]>", "Alice Maz <[email protected]>", "Sean Griffin <[email protected]>", "Adam Sharp <[email protected]>"]
description = "A `dotenv` implementation for Rust"
homepage = "https://github.com/dotenv-rs/dotenv"
Expand Down
6 changes: 5 additions & 1 deletion dotenv/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ pub fn vars() -> Vars {
/// dotenv::from_path(my_path.as_path());
/// ```
pub fn from_path<P: AsRef<Path>>(path: P) -> Result<()> {
from_path_iter(path)?.load()
let iter = Iter::new(File::open(path).map_err(Error::Io)?);
iter.load()
}

/// Like `from_path`, but returns an iterator over variables instead of loading into environment.
Expand All @@ -99,6 +100,7 @@ pub fn from_path<P: AsRef<Path>>(path: P) -> Result<()> {
/// println!("{}={}", key, val);
/// }
/// ```
#[deprecated(since = "0.14.1", note = "please use `from_path` in conjunction with `var` instead")]
pub fn from_path_iter<P: AsRef<Path>>(path: P) -> Result<Iter<File>> {
Ok(Iter::new(File::open(path).map_err(Error::Io)?))
}
Expand Down Expand Up @@ -144,6 +146,7 @@ pub fn from_filename<P: AsRef<Path>>(filename: P) -> Result<PathBuf> {
/// println!("{}={}", key, val);
/// }
/// ```
#[deprecated(since = "0.14.1", note = "please use `from_path` in conjunction with `var` instead")]
pub fn from_filename_iter<P: AsRef<Path>>(filename: P) -> Result<Iter<File>> {
let (_, iter) = Finder::new().filename(filename.as_ref()).find()?;
Ok(iter)
Expand Down Expand Up @@ -174,6 +177,7 @@ pub fn dotenv() -> Result<PathBuf> {
/// println!("{}={}", key, val);
/// }
/// ```
#[deprecated(since = "0.14.1", note = "please use `from_path` in conjunction with `var` instead")]
pub fn dotenv_iter() -> Result<iter::Iter<File>> {
let (_, iter) = Finder::new().find()?;
Ok(iter)
Expand Down
1 change: 1 addition & 0 deletions dotenv/tests/test-dotenv-iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use dotenv::*;
use crate::common::*;

#[test]
#[allow(deprecated)]
fn test_dotenv_iter() {
let dir = make_test_dotenv().unwrap();

Expand Down
1 change: 1 addition & 0 deletions dotenv/tests/test-from-filename-iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use dotenv::*;
use crate::common::*;

#[test]
#[allow(deprecated)]
fn test_from_filename_iter() {
let dir = make_test_dotenv().unwrap();

Expand Down
1 change: 1 addition & 0 deletions dotenv/tests/test-from-path-iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use dotenv::*;
use crate::common::*;

#[test]
#[allow(deprecated)]
fn test_from_path_iter() {
let dir = make_test_dotenv().unwrap();

Expand Down
2 changes: 1 addition & 1 deletion dotenv_codegen/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]

name = "dotenv_codegen"
version = "0.14.0"
version = "0.14.1"
authors = [
"Santiago Lapresta <[email protected]>",
"Craig Hills <[email protected]>",
Expand Down
2 changes: 1 addition & 1 deletion dotenv_codegen_implementation/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ proc-macro = true
[package]

name = "dotenv_codegen_implementation"
version = "0.14.0"
version = "0.14.1"
authors = [
"Santiago Lapresta <[email protected]>",
"Craig Hills <[email protected]>",
Expand Down

0 comments on commit 1f5658d

Please sign in to comment.