Browse Source

Update most Cargo dependencies

tables
Manos Pitsidianakis 7 months ago
parent
commit
2c23ca34cd
  1. 1394
      Cargo.lock
  2. 19
      Cargo.toml
  3. 24
      docs/samples/sample-config.toml
  4. 18
      melib/Cargo.toml
  5. 2
      melib/src/backends.rs
  6. 6
      melib/src/backends/notmuch.rs
  7. 4
      melib/src/connections.rs
  8. 5
      melib/src/gpgme/mod.rs
  9. 19
      src/bin.rs
  10. 4
      src/command/actions.rs
  11. 4
      src/components/mail/view.rs
  12. 2
      src/conf/accounts.rs
  13. 44
      src/jobs.rs
  14. 2
      src/sqlite3.rs
  15. 6
      src/terminal/embed.rs
  16. 2
      src/types.rs
  17. 4
      src/types/helpers.rs

1394
Cargo.lock
File diff suppressed because it is too large
View File

19
Cargo.toml

@ -27,10 +27,10 @@ path = "src/bin.rs"
[dependencies]
xdg = "2.1.0"
crossbeam = "0.7.2"
signal-hook = "0.1.12"
crossbeam = "^0.8"
signal-hook = "^0.3"
signal-hook-registry = "1.2.0"
nix = "0.17.0"
nix = "^0.24"
melib = { path = "melib", version = "0.7.2" }
serde = "1.0.71"
@ -38,20 +38,19 @@ serde_derive = "1.0.71"
serde_json = "1.0"
toml = { version = "0.5.6", features = ["preserve_order", ] }
indexmap = { version = "^1.6", features = ["serde-1", ] }
linkify = "0.4.0"
linkify = "^0.8"
notify = "4.0.1" # >:c
termion = "1.5.1"
bincode = "^1.3.0"
uuid = { version = "0.8.1", features = ["serde", "v4"] }
unicode-segmentation = "1.2.1" # >:c
libc = {version = "0.2.59", features = ["extra_traits",]}
libc = {version = "0.2.125", features = ["extra_traits",]}
smallvec = { version = "^1.5.0", features = ["serde", ] }
bitflags = "1.0"
pcre2 = { version = "0.2.3", optional = true }
structopt = { version = "0.3.14", default-features = false }
svg_crate = { version = "0.8.0", optional = true, package = "svg" }
svg_crate = { version = "^0.10", optional = true, package = "svg" }
futures = "0.3.5"
async-task = "3.0.0"
async-task = "^4.2.0"
num_cpus = "1.12.0"
flate2 = { version = "1.0.16", optional = true }
@ -59,9 +58,9 @@ flate2 = { version = "1.0.16", optional = true }
notify-rust = { version = "^4", optional = true }
[build-dependencies]
syn = { version = "1.0.31", features = [] }
syn = { version = "1.0.92", features = [] }
quote = "^1.0"
proc-macro2 = "1.0.18"
proc-macro2 = "1.0.37"
flate2 = { version = "1.0.16", optional = true }
[dev-dependencies]

24
docs/samples/sample-config.toml

@ -48,18 +48,18 @@
##subscribed_mailboxes = ["INBOX", "INBOX/Sent", "INBOX/Drafts", "INBOX/Junk"]
#
## Setting up an account for an already existing notmuch database
#[accounts.notmuch]
#root_mailbox = "/path/to/folder" # where .notmuch/ directory is located
#format = "notmuch"
#listing.index_style = "conversations"
#identity="username@example.com"
#display_name = "Name Name"
# # notmuch mailboxes are virtual, they are defined by their alias and the notmuch query that corresponds to their content.
# [accounts.notmuch.mailboxes]
# "INBOX" = { query="tag:inbox", subscribe = true }
# "Drafts" = { query="tag:draft", subscribe = true }
# "Sent" = { query="from:username@example.com from:username2@example.com", subscribe = true }
#
##[accounts.notmuch]
##root_mailbox = "/path/to/folder" # where .notmuch/ directory is located
##format = "notmuch"
##listing.index_style = "conversations"
##identity="username@example.com"
##display_name = "Name Name"
## # notmuch mailboxes are virtual, they are defined by their alias and the notmuch query that corresponds to their content.
## [accounts.notmuch.mailboxes]
## "INBOX" = { query="tag:inbox", subscribe = true }
## "Drafts" = { query="tag:draft", subscribe = true }
## "Sent" = { query="from:username@example.com from:username2@example.com", subscribe = true }
##
## Setting up a Gmail account
#[accounts."gmail"]
#root_mailbox = '[Gmail]'

18
melib/Cargo.toml

@ -22,7 +22,7 @@ path = "src/lib.rs"
bitflags = "1.0"
data-encoding = "2.1.1"
encoding = "0.2.33"
nom = { version = "5.1.1" }
nom = { version = "5" }
indexmap = { version = "^1.5", features = ["serde-1", ] }
notify = { version = "4.0.15", optional = true }
@ -31,21 +31,21 @@ native-tls = { version ="0.2.3", optional=true }
serde = { version = "1.0.71", features = ["rc", ] }
serde_derive = "1.0.71"
bincode = "^1.3.0"
uuid = { version = "0.8.1", features = ["serde", "v4", "v5"] }
uuid = { version = "^1", features = ["serde", "v4", "v5"] }
unicode-segmentation = { version = "1.2.1", optional = true }
libc = {version = "0.2.59", features = ["extra_traits",]}
isahc = { version = "0.9.7", optional = true, default-features = false, features = ["http2", "json", "text-decoding"]}
libc = {version = "0.2.125", features = ["extra_traits",]}
isahc = { version = "^1.7", optional = true, default-features = false, features = ["http2", "json", "text-decoding"]}
serde_json = { version = "1.0", optional = true, features = ["raw_value",] }
smallvec = { version = "^1.5.0", features = ["serde", ] }
nix = "0.17.0"
rusqlite = {version = "0.24.0", optional = true }
nix = "^0.24"
rusqlite = {version = "^0.27", optional = true }
libloading = "0.6.2"
libloading = "^0.7"
futures = "0.3.5"
smol = "1.0.0"
async-stream = "0.2.1"
base64 = { version = "0.12.3", optional = true }
async-stream = "^0.3"
base64 = { version = "^0.13", optional = true }
flate2 = { version = "1.0.16", optional = true }
xdg-utils = "^0.4.0"

2
melib/src/backends.rs

@ -160,7 +160,7 @@ impl Backends {
let dlpath = "libnotmuch.so.5";
#[cfg(target_os = "macos")]
let dlpath = "libnotmuch.5.dylib";
if libloading::Library::new(dlpath).is_ok() {
if unsafe { libloading::Library::new(dlpath) }.is_ok() {
b.register(
"notmuch".to_string(),
Backend {

6
melib/src/backends/notmuch.rs

@ -69,6 +69,7 @@ pub use thread::*;
#[derive(Debug)]
pub struct DbConnection {
#[allow(dead_code)]
pub lib: Arc<libloading::Library>,
pub inner: Arc<RwLock<*mut notmuch_database_t>>,
pub revision_uuid: Arc<RwLock<u64>>,
@ -215,6 +216,7 @@ impl Drop for DbConnection {
#[derive(Debug)]
pub struct NotmuchDb {
#[allow(dead_code)]
lib: Arc<libloading::Library>,
revision_uuid: Arc<RwLock<u64>>,
mailboxes: Arc<RwLock<HashMap<MailboxHash, NotmuchMailbox>>>,
@ -311,7 +313,7 @@ impl NotmuchDb {
let dlpath = "libnotmuch.so.5";
#[cfg(target_os = "macos")]
let dlpath = "libnotmuch.5.dylib";
let lib = Arc::new(libloading::Library::new(dlpath)?);
let lib = Arc::new(unsafe { libloading::Library::new(dlpath)? });
let path = Path::new(s.root_mailbox.as_str()).expand();
if !path.exists() {
return Err(MeliError::new(format!(
@ -862,6 +864,7 @@ struct NotmuchOp {
collection: Collection,
database: Arc<DbConnection>,
bytes: Option<Vec<u8>>,
#[allow(dead_code)]
lib: Arc<libloading::Library>,
}
@ -886,6 +889,7 @@ impl BackendOp for NotmuchOp {
}
pub struct Query<'s> {
#[allow(dead_code)]
lib: Arc<libloading::Library>,
ptr: *mut notmuch_query_t,
query_str: &'s str,

4
melib/src/connections.rs

@ -91,9 +91,7 @@ impl Connection {
!nix::fcntl::OFlag::O_NONBLOCK
}),
)
.map_err(|err| {
std::io::Error::from_raw_os_error(err.as_errno().map(|n| n as i32).unwrap_or(0))
})?;
.map_err(|err| std::io::Error::from_raw_os_error(err as i32))?;
Ok(())
}
#[cfg(feature = "deflate_compression")]

5
melib/src/gpgme/mod.rs

@ -213,9 +213,8 @@ impl Drop for ContextInner {
impl Context {
pub fn new() -> Result<Self> {
let lib = Arc::new(libloading::Library::new(libloading::library_filename(
"gpgme",
))?);
let lib =
Arc::new(unsafe { libloading::Library::new(libloading::library_filename("gpgme")) }?);
if unsafe { call!(&lib, gpgme_check_version)(GPGME_VERSION.as_bytes().as_ptr() as *mut _) }
.is_null()
{

19
src/bin.rs

@ -34,7 +34,7 @@ use std::path::PathBuf;
#[macro_use]
extern crate serde_derive;
extern crate linkify;
extern crate uuid;
pub(crate) use melib::uuid;
extern crate bitflags;
extern crate serde_json;
@ -84,18 +84,17 @@ fn notify(
sender: crossbeam::channel::Sender<ThreadEvent>,
) -> std::result::Result<crossbeam::channel::Receiver<c_int>, std::io::Error> {
use std::time::Duration;
let (alarm_pipe_r, alarm_pipe_w) = nix::unistd::pipe().map_err(|err| {
std::io::Error::from_raw_os_error(err.as_errno().map(|n| n as i32).unwrap_or(0))
})?;
let (alarm_pipe_r, alarm_pipe_w) =
nix::unistd::pipe().map_err(|err| std::io::Error::from_raw_os_error(err as i32))?;
let alarm_handler = move |info: &nix::libc::siginfo_t| {
let value = unsafe { info.si_value().sival_ptr as u8 };
let _ = nix::unistd::write(alarm_pipe_w, &[value]);
};
unsafe {
signal_hook_registry::register_sigaction(signal_hook::SIGALRM, alarm_handler)?;
signal_hook_registry::register_sigaction(signal_hook::consts::SIGALRM, alarm_handler)?;
}
let (s, r) = crossbeam::channel::bounded(100);
let signals = signal_hook::iterator::Signals::new(signals)?;
let mut signals = signal_hook::iterator::Signals::new(signals)?;
let _ = nix::fcntl::fcntl(
alarm_pipe_r,
nix::fcntl::FcntlArg::F_SETFL(nix::fcntl::OFlag::O_NONBLOCK),
@ -344,9 +343,9 @@ fn run_app(opt: Opt) -> Result<()> {
/* Catch SIGWINCH to handle terminal resizing */
let signals = &[
/* Catch SIGWINCH to handle terminal resizing */
signal_hook::SIGWINCH,
signal_hook::consts::SIGWINCH,
/* Catch SIGCHLD to handle embed applications status change */
signal_hook::SIGCHLD,
signal_hook::consts::SIGCHLD,
];
let signal_recvr = notify(signals, sender.clone())?;
@ -529,14 +528,14 @@ fn run_app(opt: Opt) -> Result<()> {
},
recv(signal_recvr) -> sig => {
match sig.unwrap() {
signal_hook::SIGWINCH => {
signal_hook::consts::SIGWINCH => {
if state.mode != UIMode::Fork {
state.update_size();
state.render();
state.redraw();
}
},
signal_hook::SIGCHLD => {
signal_hook::consts::SIGCHLD => {
state.rcv_event(UIEvent::EmbedInput((Key::Null, vec![0])));
state.redraw();

4
src/command/actions.rs

@ -25,11 +25,9 @@
use crate::components::Component;
pub use melib::thread::{SortField, SortOrder};
use melib::uuid::Uuid;
use std::path::PathBuf;
extern crate uuid;
use uuid::Uuid;
#[derive(Debug)]
pub enum TagAction {
Add(String),

4
src/components/mail/view.rs

@ -2466,8 +2466,8 @@ impl Component for MailView {
if let Some(filename) = u.filename() {
path.push(filename);
} else {
let u = Uuid::new_v4();
path.push(u.to_hyphenated().to_string());
let u = melib::uuid::Uuid::new_v4();
path.push(u.as_hyphenated().to_string());
}
}
match save_attachment(&path, &decode(u, None)) {

2
src/conf/accounts.rs

@ -39,7 +39,7 @@ use std::collections::{HashMap, HashSet};
use crate::types::UIEvent::{self, EnvelopeRemove, EnvelopeRename, EnvelopeUpdate, Notification};
use crate::{StatusEvent, ThreadEvent};
use crossbeam::Sender;
use crossbeam::channel::Sender;
use futures::{
future::FutureExt,
stream::{Stream, StreamExt},

44
src/jobs.rs

@ -26,24 +26,23 @@
//! let (channel, handle, job_id) = job_executor.spawn(job);
//! ```
use melib::error::Result;
use melib::smol;
use melib::uuid::Uuid;
use std::collections::HashMap;
use std::future::Future;
use std::panic::catch_unwind;
use std::sync::{Arc, Mutex};
use std::thread;
use std::time::Duration;
use uuid::Uuid;
use crate::types::{ThreadEvent, UIEvent};
use crossbeam::channel::Sender;
use crossbeam::deque::{Injector, Stealer, Worker};
use crossbeam::sync::{Parker, Unparker};
use crossbeam::Sender;
pub use futures::channel::oneshot;
use std::iter;
type AsyncTask = async_task::Task<()>;
type AsyncTask = async_task::Runnable;
fn find_task<T>(local: &Worker<T>, global: &Injector<T>, stealers: &[Stealer<T>]) -> Option<T> {
// Pop a task from the local queue, if not empty.
@ -117,7 +116,8 @@ struct TimerPrivate {
/// Time until next expiration.
value: Duration,
active: bool,
handle: Option<async_task::JoinHandle<(), ()>>,
handle: Option<async_task::Task<()>>,
cancel: Arc<Mutex<bool>>,
}
#[derive(Debug)]
@ -215,32 +215,36 @@ impl JobExecutor {
let finished_sender = self.sender.clone();
let job_id = JobId::new();
let injector = self.global_queue.clone();
let cancel = Arc::new(Mutex::new(false));
let cancel2 = cancel.clone();
// Create a task and schedule it for execution.
let (task, handle) = async_task::spawn(
let (handle, task) = async_task::spawn(
async move {
let res = future.await;
let _ = sender.send(res);
finished_sender
.send(ThreadEvent::JobFinished(job_id))
.unwrap();
Ok(())
},
move |task| {
if *cancel.lock().unwrap() {
return;
}
injector.push(MeliTask {
task,
id: job_id,
timer: false,
})
},
(),
);
task.schedule();
handle.schedule();
for unparker in self.parkers.iter() {
unparker.unpark();
}
JoinHandle {
inner: handle,
task: Arc::new(Mutex::new(Some(task))),
cancel: cancel2,
chan: receiver,
job_id,
}
@ -259,6 +263,7 @@ impl JobExecutor {
let id = Uuid::new_v4();
let timer = TimerPrivate {
interval,
cancel: Arc::new(Mutex::new(false)),
value,
active: true,
handle: None,
@ -274,9 +279,6 @@ impl JobExecutor {
pub fn rearm(&self, timer_id: Uuid) {
let mut timers_lck = self.timers.lock().unwrap();
if let Some(timer) = timers_lck.get_mut(&timer_id) {
if let Some(handle) = timer.handle.take() {
handle.cancel();
}
let value = timer.value;
drop(timers_lck);
self.arm_timer(timer_id, value);
@ -288,6 +290,8 @@ impl JobExecutor {
let sender = self.sender.clone();
let injector = self.global_queue.clone();
let timers = self.timers.clone();
let cancel = Arc::new(Mutex::new(false));
let cancel2 = cancel.clone();
let (task, handle) = async_task::spawn(
async move {
let mut value = value;
@ -312,16 +316,19 @@ impl JobExecutor {
}
},
move |task| {
if *cancel.lock().unwrap() {
return;
}
injector.push(MeliTask {
task,
id: job_id,
timer: true,
})
},
(),
);
self.timers.lock().unwrap().entry(id).and_modify(|timer| {
timer.handle = Some(handle);
timer.cancel = cancel2;
timer.active = true;
});
task.schedule();
@ -333,10 +340,8 @@ impl JobExecutor {
fn disable_timer(&self, id: Uuid) {
let mut timers_lck = self.timers.lock().unwrap();
if let Some(timer) = timers_lck.get_mut(&id) {
if let Some(handle) = timer.handle.take() {
handle.cancel();
}
timer.active = false;
*timer.cancel.lock().unwrap() = true;
}
}
@ -353,14 +358,15 @@ pub type JobChannel<T> = oneshot::Receiver<T>;
#[derive(Debug)]
/// JoinHandle for the future that allows us to cancel the task.
pub struct JoinHandle<T> {
pub inner: async_task::JoinHandle<Result<()>, ()>,
pub task: Arc<Mutex<Option<async_task::Task<()>>>>,
pub chan: JobChannel<T>,
pub cancel: Arc<Mutex<bool>>,
pub job_id: JobId,
}
impl<T> JoinHandle<T> {
pub fn cancel(&self) {
self.inner.cancel()
*self.cancel.lock().unwrap() = true;
}
}

2
src/sqlite3.rs

@ -375,7 +375,7 @@ pub fn search(
.map_err(|e| MeliError::new(e.to_string()))?;
let results = stmt
.query_map(rusqlite::NO_PARAMS, |row| Ok(row.get(0)?))
.query_map([], |row| Ok(row.get(0)?))
.map_err(|e| MeliError::new(e.to_string()))?
.map(|r: std::result::Result<Vec<u8>, rusqlite::Error>| {
Ok(u64::from_be_bytes(

6
src/terminal/embed.rs

@ -80,11 +80,11 @@ pub fn create_pty(
ws_ypixel: 0,
};
let master_fd = master_fd.clone().into_raw_fd();
let master_fd = master_fd.as_raw_fd();
unsafe { set_window_size(master_fd, &winsize)? };
}
let child_pid = match fork()? {
let child_pid = match unsafe { fork()? } {
ForkResult::Child => {
/* Open slave end for pseudoterminal */
let slave_fd = open(Path::new(&slave_name), OFlag::O_RDWR, stat::Mode::empty())?;
@ -152,7 +152,7 @@ pub fn create_pty(
ForkResult::Parent { child } => child,
};
let stdin = unsafe { std::fs::File::from_raw_fd(master_fd.clone().into_raw_fd()) };
let stdin = unsafe { std::fs::File::from_raw_fd(master_fd.as_raw_fd()) };
let mut embed_grid = EmbedTerminal::new(stdin, child_pid);
embed_grid.set_terminal_size((width, height));
let grid = Arc::new(Mutex::new(embed_grid));

2
src/types.rs

@ -42,10 +42,10 @@ use crate::components::{Component, ComponentId, ScrollUpdate};
use std::sync::Arc;
use melib::backends::{AccountHash, BackendEvent, MailboxHash};
use melib::uuid::Uuid;
use melib::{EnvelopeHash, RefreshEvent, ThreadHash};
use nix::unistd::Pid;
use std::fmt;
use uuid::Uuid;
#[derive(Debug)]
pub enum StatusEvent {

4
src/types/helpers.rs

@ -25,7 +25,7 @@ use std::io::{Read, Write};
use std::os::unix::fs::PermissionsExt;
use std::path::PathBuf;
use uuid::Uuid;
use melib::uuid::Uuid;
#[derive(Debug)]
pub struct File {
@ -84,7 +84,7 @@ pub fn create_temp_file(
dir.push(filename)
} else {
let u = Uuid::new_v4();
dir.push(u.to_hyphenated().to_string());
dir.push(u.as_hyphenated().to_string());
}
&dir
});

Loading…
Cancel
Save