pub struct BatchRunner { /* private fields */ }Available on crate feature
dyntest only.Expand description
批量运行器:串行执行多个 DnyTask,可选超时、仅编译、依赖缓存与逐任务回调。
§Feature Requirement
需要同时启用 "dyntest" 与 "std" 特性。
§Examples
use lib_unknown::dyntest::{BatchRunner, DnyTask};
let tasks = [DnyTask::new("a", "fn main() {}"), DnyTask::new("b", "fn main() {}")];
let results = BatchRunner::new().only_build(true).run(tasks);
assert_eq!(results.len(), 2);Implementations§
Source§impl BatchRunner
impl BatchRunner
Sourcepub fn timeout(self, d: Duration) -> Self
pub fn timeout(self, d: Duration) -> Self
设置单个任务编译 + 运行的总超时,超时后子进程被终止,结果记为 SystemError::Timeout。
§Feature Requirement
需要同时启用 "dyntest" 与 "std" 特性。
Sourcepub fn only_build(self, b: bool) -> Self
pub fn only_build(self, b: bool) -> Self
Sourcepub fn run<I, T>(self, tasks: I) -> Vec<(String, DnyResult)>
pub fn run<I, T>(self, tasks: I) -> Vec<(String, DnyResult)>
串行执行全部任务,返回按输入顺序的 (标识, 结果) 列表;空输入直接返回空列表。
§Feature Requirement
需要同时启用 "dyntest" 与 "std" 特性。
§Examples
use lib_unknown::dyntest::{BatchRunner, DnyTask};
let results = BatchRunner::new().run([DnyTask::new("a", "fn main() {}")]);
assert!(results[0].1.ok);§Panics
- 任务工程目录创建/文件写入失败(磁盘不可写、权限不足)时 panic,源于内部
DnyRun初始化。
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for BatchRunner
impl !Send for BatchRunner
impl !Sync for BatchRunner
impl !UnwindSafe for BatchRunner
impl Freeze for BatchRunner
impl Unpin for BatchRunner
impl UnsafeUnpin for BatchRunner
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more