rough-minister-58256
03/24/2017, 9:17 PMGiven()
or given=()
rough-minister-58256
03/24/2017, 9:17 PMrough-minister-58256
03/24/2017, 9:18 PMrough-minister-58256
03/24/2017, 9:19 PM[omerta pants (kwlzn/snapshot_tmp)]$ ag -i rule | wc -l
803
[omerta pants (kwlzn/snapshot_tmp)]$ ag -i directive | wc -l
4
witty-crayon-22786
03/24/2017, 10:08 PMrough-minister-58256
03/26/2017, 11:54 PMerror[E0277]: the trait bound `std::string::String: std::convert::From<std::io::Error>` is not satisfied
--> src/rust/engine/src/fs.rs:781:7
|
781 | util::safe_create_dir_all(dest_dir)?;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From<std::io::Error>` is not implemented for `std::string::String`
|
= help: the following implementations were found:
<std::string::String as std::convert::From<&'a str>>
<std::string::String as std::convert::From<std::borrow::Cow<'a, str>>>
= note: required by `std::convert::From::from`
error: aborting due to previous error
rough-minister-58256
03/26/2017, 11:54 PMString
?rough-minister-58256
03/27/2017, 1:00 AMResult<(), String>
for ?
i guessrough-minister-58256
03/27/2017, 1:01 AMIn case of the Err variant, it retrieves the inner error. try! then performs conversion using From. This provides automatic conversion between specialized errors and more general ones. The resulting error is then immediately returned.
rough-minister-58256
03/27/2017, 1:01 AMFrom
fancy-queen-20734
03/27/2017, 4:05 PMfancy-queen-20734
03/27/2017, 4:28 PMfancy-queen-20734
03/27/2017, 4:28 PMwitty-crayon-22786
03/27/2017, 4:29 PMfancy-queen-20734
03/27/2017, 4:31 PMfancy-queen-20734
03/27/2017, 4:33 PMwitty-crayon-22786
03/27/2017, 4:55 PMwitty-crayon-22786
03/27/2017, 4:56 PMfancy-queen-20734
03/27/2017, 5:22 PMrough-minister-58256
03/27/2017, 6:00 PMself.x = y
)? turns out that with v2 + multiple tasks that include clean-all (./pants clean-all test blah
) the snapshot dir used used by the engine is ofc blown away. so was going to check that inline when the “property” method is called and reinitialize the TempDir inline if needed. a cheaper hack might just be to recreate its original dir, which should be safe as the random dir path collision would be ~inprobable - but not entirely impossible due to not reinvoking the TempDir creation logic.rough-minister-58256
03/27/2017, 6:01 PMCell
and RefCell
but neither seemed to fit per the compilerwitty-crayon-22786
03/27/2017, 6:31 PMmap_err(|e| ...)?
to convert from one error type to another before raisingrough-minister-58256
03/27/2017, 6:31 PMwitty-crayon-22786
03/27/2017, 6:31 PMrough-minister-58256
03/27/2017, 6:38 PMfn?
call’s Result
to its calling fn’s Result
type that wasn’t immediately clear, but makes sense now and now fully grok map_err
etcwitty-crayon-22786
03/27/2017, 6:50 PMRefCell
... but in this case it does need to threadsafe, so you'd need a Mutex
probablywitty-crayon-22786
03/27/2017, 6:51 PMrough-minister-58256
03/27/2017, 6:56 PMwitty-crayon-22786
03/27/2017, 7:00 PMpub struct Snapshots {
..
temp_dir: TempDir,
next_temp_id: atomic::AtomicUsize,
}
with pub struct Snapshots {
..
temp_generator: Mutex<(TempDir, usize)>
}
witty-crayon-22786
03/27/2017, 7:00 PM