remove unneeded cloning
This commit is contained in:
@@ -4,14 +4,14 @@ use regex::bytes::{Regex, RegexBuilder};
|
|||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
pub from: PathBuf,
|
pub from: PathBuf,
|
||||||
pub to: PathBuf,
|
pub to: PathBuf,
|
||||||
pub matches: Vec<TranscodeMatch>,
|
pub matches: Vec<TranscodeMatch>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Debug)]
|
||||||
pub struct TranscodeMatch {
|
pub struct TranscodeMatch {
|
||||||
pub regexes: Vec<Regex>,
|
pub regexes: Vec<Regex>,
|
||||||
pub to: Transcode,
|
pub to: Transcode,
|
||||||
|
|||||||
12
src/main.rs
12
src/main.rs
@@ -174,18 +174,18 @@ async fn main_loop(ui_queue: ui::MsgQueue) -> Result<()> {
|
|||||||
stream::iter(conv_args.into_iter().enumerate())
|
stream::iter(conv_args.into_iter().enumerate())
|
||||||
.map(Ok)
|
.map(Ok)
|
||||||
.try_for_each_concurrent(num_cpus::get(), |(i, args)| {
|
.try_for_each_concurrent(num_cpus::get(), |(i, args)| {
|
||||||
let config = config.clone();
|
let config = &config;
|
||||||
let msg_queue = ui_queue.clone();
|
let ui_queue = &ui_queue;
|
||||||
let log_path = &log_path;
|
let log_path = &log_path;
|
||||||
|
|
||||||
async move {
|
async move {
|
||||||
msg_queue.push(ui::Msg::TaskStart {
|
ui_queue.push(ui::Msg::TaskStart {
|
||||||
id: i,
|
id: i,
|
||||||
args: args.clone(),
|
args: args.clone(),
|
||||||
});
|
});
|
||||||
|
|
||||||
match transcode(&config, &args, i, &msg_queue).await {
|
match transcode(config, &args, i, ui_queue).await {
|
||||||
Ok(()) => msg_queue.push(ui::Msg::TaskEnd { id: i }),
|
Ok(()) => ui_queue.push(ui::Msg::TaskEnd { id: i }),
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
let err = err.context(format!(
|
let err = err.context(format!(
|
||||||
"failed transcoding \"{}\"",
|
"failed transcoding \"{}\"",
|
||||||
@@ -218,7 +218,7 @@ async fn main_loop(ui_queue: ui::MsgQueue) -> Result<()> {
|
|||||||
})
|
})
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
msg_queue.push(ui::Msg::TaskError { id: i });
|
ui_queue.push(ui::Msg::TaskError { id: i });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user