Last active
March 3, 2017 20:24
-
-
Save U007D/992776b73498b39a07fdf3e6538da5cc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait ArgsExtensionMethods { | |
fn getOutputFilename(self) -> Option<String>; | |
// fn removeOutputFile(&self) -> Args; | |
// fn removeNoStartFiles(&self) -> Args; | |
// fn removeWlSwitches(&self) -> Args; | |
} | |
// | |
impl<T> ArgsExtensionMethods for T where T: IntoIterator<Item=String> { | |
fn getOutputFilename(self) -> Option<String> { | |
self.skip_while(|ref el| *el != "-o").next() | |
} | |
} | |
pub fn libMain<T>(args: T) where T: IntoIterator<Item=String> | |
{ | |
} | |
#[cfg(test)] | |
mod tests; | |
-- | |
error: no method named `skip_while` found for type `T` in the current scope | |
--> src/lib.rs:17:14 | |
| | |
17 | self.skip_while(|ref el| *el != "-o").next() | |
| ^^^^^^^^^^ | |
| | |
= note: the method `skip_while` exists but the following trait bounds were not satisfied: `T : std::iter::Iterator` | |
= help: items from traits can only be used if the trait is implemented and in scope; the following trait defines an item `skip_while`, perhaps you need to implement it: | |
= help: candidate #1: `std::iter::Iterator` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::env::Args; | |
extern crate xargo_lld_wrapper; | |
fn main() { | |
lib::libMain(std::env::args()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Working config: lib.rs/test.rs/app.rs | |
/Users/bRad/.cargo/bin/cargo test --color=always | |
Compiling xargo-lld-wrapper v0.1.0 (file:///Users/bRad/Development/bg/experiments/rust/rpi3/xargo-lld-wrapper) | |
warning: unused variable: `args` | |
--> src/lib.rs:23:16 | |
| | |
23 | pub fn libMain(args: Args) | |
| ^^^^ | |
| | |
= note: #[warn(unused_variables)] on by default | |
warning: unused import: `super::*;` | |
--> src/tests.rs:1:5 | |
| | |
1 | use super::*; | |
| ^^^^^^^^^ | |
| | |
= note: #[warn(unused_imports)] on by default | |
Finished dev [unoptimized + debuginfo] target(s) in 1.54 secs | |
Running target/debug/deps/xargo_lld_wrapper-dc5583a5b836a9c8 | |
running 1 test | |
test tests::app_call_with_no_params_succeeds ... ok | |
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured | |
Doc-tests xargo-lld-wrapper | |
running 0 tests | |
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured | |
Process finished with exit code 0 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Exactly same project, renaming | |
Renaming app.rs -> main.rs: | |
/Users/bRad/.cargo/bin/cargo test --color=always | |
Compiling xargo-lld-wrapper v0.1.0 (file:///Users/bRad/Development/bg/experiments/rust/rpi3/xargo-lld-wrapper) | |
error: cannot declare a new module at this location | |
--> src/lib.rs:28:5 | |
| | |
28 | mod tests; | |
| ^^^^^ | |
| | |
note: maybe move this module `src` to its own directory via `src/mod.rs` | |
--> src/lib.rs:28:5 | |
| | |
28 | mod tests; | |
| ^^^^^ | |
note: ... or maybe `use` the module `tests` instead of possibly redeclaring it | |
--> src/lib.rs:28:5 | |
| | |
28 | mod tests; | |
| ^^^^^ | |
error: aborting due to previous error | |
error: Could not compile `xargo-lld-wrapper`. | |
To learn more, run the command again with --verbose. | |
Process finished with exit code 101 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment