diff options
author | Cyril Plisko <cyril.plisko@mountall.com> | 2016-08-05 18:55:50 +0300 |
---|---|---|
committer | Cyril Plisko <cyril.plisko@mountall.com> | 2016-08-05 18:55:50 +0300 |
commit | 8d6fcf247043ee5039e57401a8fdc78528d357f9 (patch) | |
tree | a6dbe3ed9438fdcecfe2d0d61b51b604cfed4582 /src/lib.rs | |
parent | 7b4976ac84bc1456d5d7f0b3b96c54c6b4b3325c (diff) |
Make Pager::env() another form of constructor
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -23,7 +23,7 @@ //! extern crate pager; //! use pager::Pager; //! fn main() { -//! Pager::new().env("MY_PAGER").setup(); +//! Pager::env("MY_PAGER").setup(); //! // The rest of your program goes here //! } //! ``` @@ -56,9 +56,11 @@ impl Pager { } } - pub fn env(&mut self, env: &str) -> &Self { - self.env = String::from(env); - self + pub fn env(env: &str) -> Self { + Pager { + env: String::from(env), + ok: true, + } } pub fn ok(&self) -> bool { |