commit_hash stringlengths 40 40 | author stringlengths 1 57 | date timestamp[s]date 2010-07-26 04:45:09 2026-04-14 18:21:10 | message stringlengths 8 1.39M | diff stringlengths 68 51.2k | files_changed int64 1 136 | insertions int64 0 2.35k | deletions int64 0 1.9k |
|---|---|---|---|---|---|---|---|
d581328c1c7e2cc4230bd13eb2431c2bd1469923 | Antti Keränen | 2017-07-17T04:14:19 | Separate implementation to different files | diff --git a/src/error.rs b/src/error.rs
new file mode 100644
index 0000000..10a264d
--- /dev/null
+++ b/src/error.rs
@@ -0,0 +1,34 @@
+use std;
+use std::fmt;
+
+/// Ctrl-C error.
+#[derive(Debug)]
+pub enum Error {
+ /// Ctrl-C signal handler already registered.
+ MultipleHandlers,
+ /// Unexpected system er... | 6 | 236 | 200 |
b5b68f509204b159eae20241bfa4d1a583a7b2e8 | Antti Keränen | 2017-10-13T10:24:14 | Split 100+ length comment to two lines | diff --git a/src/tests.rs b/src/tests.rs
index c70dd93..6588f61 100644
--- a/src/tests.rs
+++ b/src/tests.rs
@@ -44,7 +44,8 @@ mod platform {
use self::winapi::winnt::{CHAR, HANDLE};
use self::winapi::minwindef::DWORD;
- /// Stores a piped stdout handle or a cache that gets flushed when we reattached to ... | 1 | 2 | 1 |
1d37a81696e5902b2bac8656022aa9089b2a1184 | Antti Keränen | 2017-10-13T06:24:57 | Format source with `rustfmt`. | diff --git a/src/lib.rs b/src/lib.rs
index db6b72e..7d63e44 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -95,7 +95,7 @@ mod platform {
static mut PIPE: (RawFd, RawFd) = (-1, -1);
- extern fn os_handler(_: nix::c_int) {
+ extern "C" fn os_handler(_: nix::c_int) {
// Assuming this always succeeds. ... | 2 | 44 | 34 |
416078f292521410a7544b6ca0b2f9445d9b7398 | Antti Keränen | 2017-10-13T05:42:54 | Update the example
Add an millisecond of sleep to prevent 100% CPU usage | diff --git a/examples/readme_example.rs b/examples/readme_example.rs
index 4acb710..256fd7f 100644
--- a/examples/readme_example.rs
+++ b/examples/readme_example.rs
@@ -8,17 +8,19 @@
// according to those terms.
extern crate ctrlc;
-use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
+use std::sync:... | 1 | 7 | 5 |
fca4ce1378548de81a842492ece77752931717cc | Antti Keränen | 2017-10-07T13:13:44 | Release 3.0.3 | diff --git a/Cargo.toml b/Cargo.toml
index 93838b8..ce262ed 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "ctrlc"
-version = "3.0.2"
+version = "3.0.3"
authors = ["Antti Keränen <detegr@gmail.com>", "nabijaczleweli <nabijaczleweli@gmail.com>", "Henning Ottesen <henning@live.no>", "Peter... | 1 | 1 | 1 |
9f915082e6657a054e5df69bd533af6cac4efa4a | Henning Ottesen | 2017-06-11T00:08:40 | Custom test harness
- Run tests on a secondary console on windows.
- Workaround for GenerateConsoleCtrlEvent() signaling the whole process group.
- Enforces serialization and deterministic order for tests.
- Uses SetStdHandle(). This breaks Rust's stdout for Rust pre 1.18.0. | diff --git a/Cargo.toml b/Cargo.toml
index e16f468..93838b8 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -17,3 +17,8 @@ kernel32-sys = "0.2"
[features]
termination = []
+
+[[test]]
+name = "tests"
+path = "src/tests.rs"
+harness = false
diff --git a/src/lib.rs b/src/lib.rs
index 9d1ed16..db6b72e 100644
--- a/src/lib... | 3 | 270 | 30 |
5f1a755bfb303c309f3a8e4c43d429572c70def5 | Henning Ottesen | 2017-05-30T20:10:46 | Improved error handling and documentation
- Avoid panics.
- Cleanup resources on error.
- Document errors.
- Document SIGTERM.
- `no_run` examples.
- Use nix crate instead of raw libc bindings.
- Use std::io::Error for system errors and errno.
- Simplify Error enum.
- Use sigaction() instead of signal(). | diff --git a/Cargo.toml b/Cargo.toml
index 1634f89..e16f468 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,7 +11,7 @@ homepage = "https://github.com/Detegr/rust-ctrlc"
repository = "https://github.com/Detegr/rust-ctrlc.git"
[dependencies]
-libc = "0.2"
+nix = "0.8"
winapi = "0.2"
kernel32-sys = "0.2"
diff --gi... | 2 | 211 | 107 |
c54222927f2dc59ea4afb8357503e248e8bbfb91 | Antti Keränen | 2017-05-29T05:20:13 | Bump version number | diff --git a/Cargo.toml b/Cargo.toml
index 45769b5..1634f89 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "ctrlc"
-version = "3.0.1"
+version = "3.0.2"
authors = ["Antti Keränen <detegr@gmail.com>", "nabijaczleweli <nabijaczleweli@gmail.com>", "Henning Ottesen <henning@live.no>", "Peter... | 1 | 1 | 1 |
48d0598f83794e45242300b7eb990baa8b7dac5d | Dru Sellers | 2017-05-24T20:29:55 | Sweeping | diff --git a/src/lib.rs b/src/lib.rs
index 795f23f..d419cb1 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -43,7 +43,7 @@ impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
use std::error::Error;
- write!(f, "CtrlC Error: {}", self.description())
+ wr... | 1 | 2 | 2 |
ea9e09074fd600d5437c8ff0181b40d88efb7433 | Dru Sellers | 2017-05-23T15:05:49 | Move the use as close as possible | diff --git a/src/lib.rs b/src/lib.rs
index d0512ca..795f23f 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -26,7 +26,6 @@
//! }
//! ```
-use std::error::Error as StdError;
use std::fmt;
use std::sync::atomic::{AtomicBool, Ordering, ATOMIC_BOOL_INIT};
use std::thread;
@@ -42,6 +41,8 @@ pub enum Error {
impl fmt::... | 1 | 2 | 1 |
da6af854187fb6abd3faa1c04a3935fd0fc0e40c | Dru Sellers | 2017-05-23T15:05:33 | Implement the trait directly | diff --git a/src/lib.rs b/src/lib.rs
index 0b06e0f..d0512ca 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -46,7 +46,7 @@ impl fmt::Display for Error {
}
}
-impl StdError for Error {
+impl std::error::Error for Error {
fn description(&self) -> &str {
match *self {
Error::Init(ref msg) =>... | 1 | 1 | 1 |
b1e0e4afebd7ee8ec256b79e1dcb9b2d9be1efe5 | Dru Sellers | 2017-05-21T12:55:39 | Implement std::error::Error for ctrlc::Error | diff --git a/src/lib.rs b/src/lib.rs
index b8a475b..0b06e0f 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -26,6 +26,8 @@
//! }
//! ```
+use std::error::Error as StdError;
+use std::fmt;
use std::sync::atomic::{AtomicBool, Ordering, ATOMIC_BOOL_INIT};
use std::thread;
@@ -38,6 +40,22 @@ pub enum Error {
SetHa... | 1 | 18 | 0 |
2f464f06d74077ce2a259647adc6e964d833fb3e | Henning Ottesen | 2017-05-19T11:04:05 | Use correct calling convention for os_handler on nix | diff --git a/src/lib.rs b/src/lib.rs
index b8a475b..fce8f8b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -71,14 +71,14 @@ mod platform {
fn errno_location() -> *mut c_int;
}
- unsafe fn os_handler(_: c_int) {
+ unsafe extern "C" fn os_handler(_: c_int) {
// Assuming this always succeeds. C... | 1 | 3 | 3 |
419b84d8d07700a0aac858039ef33fc52605dd19 | Antti Keränen | 2017-02-19T17:53:01 | Remove an example, add a test for multiple handler registration
The `simple` example was a bit too simple with no easy way to shut down
the executable. I feel that the readme example does a better job
explaining this crate anyway, so removed the `simple` example.
Bump version number to 3.0.1 | diff --git a/Cargo.toml b/Cargo.toml
index dc1d2a2..45769b5 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "ctrlc"
-version = "3.0.0"
+version = "3.0.1"
authors = ["Antti Keränen <detegr@gmail.com>", "nabijaczleweli <nabijaczleweli@gmail.com>", "Henning Ottesen <henning@live.no>", "Peter... | 3 | 7 | 20 |
da53a7a4ae58a19032758a551308193db8d63a70 | Antti Keränen | 2017-02-18T08:09:39 | Change the implementation on *nix platforms
macOS does not support `sem_init` so changing the implementation on unix
like platforms to the pipe trick suggested in #12 | diff --git a/src/lib.rs b/src/lib.rs
index e213974..7872d59 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -45,13 +45,16 @@ mod platform {
use ::Error;
use self::libc::c_int;
use self::libc::{signal, sighandler_t, SIGINT, SIG_ERR, EINTR};
- use self::libc::{sem_t, sem_init, sem_wait, sem_post};
+
+ ty... | 1 | 24 | 18 |
a55b131fd8bb43ed6b1e7953b1eebab8ad2c6874 | Antti Keränen | 2017-02-12T14:12:26 | Use Result for error handling | diff --git a/examples/readme_example.rs b/examples/readme_example.rs
index 6af370e..4acb710 100644
--- a/examples/readme_example.rs
+++ b/examples/readme_example.rs
@@ -15,8 +15,9 @@ fn main() {
let running = Arc::new(AtomicBool::new(true));
let r = running.clone();
ctrlc::set_handler(move || {
- ... | 3 | 53 | 21 |
43c75e881066ae0d521ddbd8a49f10a1395ad9ac | Henning Ottesen | 2017-02-02T17:14:39 | Polling free implementation using semaphores | diff --git a/src/lib.rs b/src/lib.rs
index 6d39345..c708db1 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -26,63 +26,122 @@
//! }
//! ```
-use std::sync::atomic::Ordering;
+use std::sync::atomic::{AtomicBool, Ordering, ATOMIC_BOOL_INIT};
use std::thread;
-use std::time;
-use std::sync::atomic::{AtomicBool, ATOMIC_... | 1 | 89 | 48 |
547195d1244d2c30f62106a0439cb44e16c8ce6f | Antti Keränen | 2016-09-04T14:04:18 | Add a feature flag `termination`
This feature flag allows the users to set the handler for SIGTERM as well as SIGINT.
The flag only affects Linux at the moment. | diff --git a/Cargo.toml b/Cargo.toml
index 28da4d9..0cfe251 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "ctrlc"
-version = "2.0.0"
+version = "2.0.1"
authors = ["Antti Keränen <detegr@gmail.com>"]
license = "MIT/Apache-2.0"
keywords = ["ctrlc", "signal", "SIGINT"]
@@ -14,3 +14,6 @@ ... | 2 | 21 | 8 |
9db992c73028094d38024302cd4a894605693f69 | Antti Keränen | 2016-04-20T15:19:43 | Bump major version number
Because of backwards-incompatible changes | diff --git a/Cargo.toml b/Cargo.toml
index f7b06a0..28da4d9 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "ctrlc"
-version = "1.1.1"
+version = "2.0.0"
authors = ["Antti Keränen <detegr@gmail.com>"]
license = "MIT/Apache-2.0"
keywords = ["ctrlc", "signal", "SIGINT"] | 1 | 1 | 1 |
6e09346683626669da6045ea72eb06ac88fe36ba | Antti Keränen | 2016-02-21T13:33:19 | Bump version number | diff --git a/Cargo.toml b/Cargo.toml
index ae3ad70..f7b06a0 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "ctrlc"
-version = "1.1.0"
+version = "1.1.1"
authors = ["Antti Keränen <detegr@gmail.com>"]
license = "MIT/Apache-2.0"
keywords = ["ctrlc", "signal", "SIGINT"] | 1 | 1 | 1 |
406b7c289842432a2e86a169d018456b9a552603 | quininer kel | 2016-02-21T11:10:22 | fix repr C fn | diff --git a/src/lib.rs b/src/lib.rs
index e9d132c..4363caf 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -46,7 +46,6 @@ mod platform {
use self::libc::signal;
use std::sync::atomic::Ordering;
- #[repr(C)]
pub fn handler(_: c_int) {
super::features::DONE.store(true, Ordering::Relaxed);
} | 1 | 0 | 1 |
785fd3344abed9db74c14d267a8d7af34fc53e17 | Antti Keränen | 2016-02-10T17:03:15 | Add documentation to Cargo.toml | diff --git a/Cargo.toml b/Cargo.toml
index 69b54b5..ae3ad70 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -6,6 +6,7 @@ authors = ["Antti Keränen <detegr@gmail.com>"]
license = "MIT/Apache-2.0"
keywords = ["ctrlc", "signal", "SIGINT"]
description = "Easy Ctrl-C handler for Rust projects"
+documentation = "http://detegr... | 1 | 1 | 0 |
d779dbdce562fbe94ca48184056a278fb0f4f386 | Antti Keränen | 2016-02-10T16:47:07 | Version 1.1.0
Fixes #6 | diff --git a/Cargo.toml b/Cargo.toml
index de1e564..69b54b5 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "ctrlc"
-version = "1.0.1"
+version = "1.1.0"
authors = ["Antti Keränen <detegr@gmail.com>"]
license = "MIT/Apache-2.0"
keywords = ["ctrlc", "signal", "SIGINT"] | 1 | 1 | 1 |
86412ec2bfd8124047ea964e7b22c7db66ac4809 | Antti Keränen | 2016-02-10T16:46:38 | Add a way to specify the polling rate. Improve documentation | diff --git a/src/lib.rs b/src/lib.rs
index 5e7ccf3..e9d132c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -7,9 +7,29 @@
// notice may not be copied, modified, or distributed except
// according to those terms.
-//! A simple easy to use wrapper around Ctrl-C signal.
+//! A simple easy to use wrapper around Ctrl-C.
+//... | 1 | 50 | 6 |
8cfb769e0b90907e11ae5f6df925f7d35e6866c9 | Antti Keränen | 2016-02-10T16:46:11 | Remove lazy_static from dependencies as it is not used anymore | diff --git a/Cargo.toml b/Cargo.toml
index 774f79e..de1e564 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,12 +13,3 @@ repository = "https://github.com/Detegr/rust-ctrlc.git"
libc = "0.2"
winapi = "0.2"
kernel32-sys = "0.2"
-
-[dependencies.lazy_static]
-version = "0.1"
-optional = true
-
-[features]
-default = ["s... | 1 | 0 | 9 |
e5c7ed2187739f23ff10791b543df03f394cdd11 | Antti Keränen | 2016-01-19T16:31:47 | Remove condition variable usage
Condition variables are not safe to use in signal handlers.
Therefore this commit removes the usage of condition variables
and uses spinloop in `set_handler` instead. | diff --git a/src/lib.rs b/src/lib.rs
index 1c56684..ca82c0f 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -9,31 +9,10 @@
//! A simple easy to use wrapper around Ctrl-C signal.
-#![cfg_attr(feature="nightly", feature(static_condvar))]
-#![cfg_attr(feature="nightly", feature(static_mutex))]
-
-#[cfg(feature="stable")]... | 1 | 3 | 27 |
581a6f519bd1ca80055a4410ea39ce793bee651e | Antti Keränen | 2016-01-14T12:28:25 | Change version to 1.0.1 | diff --git a/Cargo.toml b/Cargo.toml
index d861aab..774f79e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "ctrlc"
-version = "1.0.0"
+version = "1.0.1"
authors = ["Antti Keränen <detegr@gmail.com>"]
license = "MIT/Apache-2.0"
keywords = ["ctrlc", "signal", "SIGINT"] | 1 | 1 | 1 |
eaeebb9927431b7899591b89045b519750e4bffa | Antti Keränen | 2016-01-14T10:27:05 | Update kernel32-sys from 0.1 to 0.2 | diff --git a/Cargo.toml b/Cargo.toml
index 6fc1581..d861aab 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,7 +12,7 @@ repository = "https://github.com/Detegr/rust-ctrlc.git"
[dependencies]
libc = "0.2"
winapi = "0.2"
-kernel32-sys = "0.1"
+kernel32-sys = "0.2"
[dependencies.lazy_static]
version = "0.1" | 1 | 1 | 1 |
223e388c4e6a2dba73fae5dce2c9dcf1e2d26657 | Antti Keränen | 2016-01-14T12:05:42 | Update libc from 0.1 to 0.2 | diff --git a/Cargo.toml b/Cargo.toml
index 26ec75c..6fc1581 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -10,7 +10,7 @@ homepage = "https://github.com/Detegr/rust-ctrlc"
repository = "https://github.com/Detegr/rust-ctrlc.git"
[dependencies]
-libc = "0.1"
+libc = "0.2"
winapi = "0.2"
kernel32-sys = "0.1"
diff --g... | 2 | 4 | 4 |
2ab74b5b0b811c83864db83ce71e78fe7f6cdc72 | Antti Keränen | 2015-10-04T07:19:51 | Bump version to 1.0.0 | diff --git a/Cargo.toml b/Cargo.toml
index e19b0f9..2834ea3 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "ctrlc"
-version = "0.1.2"
+version = "1.0.0"
authors = ["Antti Keränen <detegr@gmail.com>"]
license = "MIT"
keywords = ["ctrlc", "signal", "SIGINT"] | 1 | 1 | 1 |
c0b90811ed72a7da98d371cdc152b3dd989b38f9 | Jason Dagit | 2015-10-04T02:14:46 | Reset DONE status after a successful wait | diff --git a/src/lib.rs b/src/lib.rs
index 35099e1..1cb7372 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -84,6 +84,7 @@ impl CtrlC {
loop {
if !DONE.load(Ordering::Relaxed) {
let _ = CVAR.wait(MUTEX.lock().unwrap());
+ DONE.store(false, Ordering::Rela... | 1 | 1 | 0 |
921ae3062cfaab4bb683f832674ab3195690da15 | Antti Keränen | 2015-08-12T15:14:35 | Moved platform-specific crates under 'platform' module | diff --git a/src/lib.rs b/src/lib.rs
index 5a1fa25..35099e1 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -3,18 +3,12 @@
#![cfg_attr(feature="nightly", feature(static_condvar))]
#![cfg_attr(feature="nightly", feature(static_mutex))]
-use std::sync::atomic::Ordering;
-
-#[cfg(not(windows))]
-extern crate libc;
-#[cfg(... | 1 | 11 | 14 |
dcb5959b382ad60dd14394945b41f0fcc1cc153e | Antti Keränen | 2015-07-31T07:15:59 | Fix for possible spurious wakeups
Fixes #1 | diff --git a/src/lib.rs b/src/lib.rs
index 24d489b..5a1fa25 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -3,6 +3,8 @@
#![cfg_attr(feature="nightly", feature(static_condvar))]
#![cfg_attr(feature="nightly", feature(static_mutex))]
+use std::sync::atomic::Ordering;
+
#[cfg(not(windows))]
extern crate libc;
#[cfg(wi... | 1 | 13 | 1 |
c063e070ed394a7d3107ffa6af29e714627cd80b | Peter Atashian | 2015-07-29T23:07:52 | Fix Windows code
Signed-off-by: Peter Atashian <retep998@gmail.com> | diff --git a/Cargo.toml b/Cargo.toml
index 4b00fbe..30879df 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,6 +11,8 @@ repository = "https://github.com/Detegr/rust-ctrlc.git"
[dependencies]
libc = "0.1"
+winapi = "0.2"
+kernel32-sys = "0.1"
[dependencies.lazy_static]
version = "0.1"
diff --git a/src/lib.rs b/sr... | 2 | 13 | 12 |
483ce083626bd2cdb3be82c7e01a02bb61ccdaab | Antti Keränen | 2015-07-16T09:23:59 | Added warning to simple.rs | diff --git a/examples/simple.rs b/examples/simple.rs
index 380f3f0..e977919 100644
--- a/examples/simple.rs
+++ b/examples/simple.rs
@@ -1,3 +1,8 @@
+// Warning: If you run this example with `cargo run --example simple`
+// and hit Ctrl-C, the executable will still be kept running using
+// 100% of CPU. This is because... | 1 | 5 | 0 |
37011f2f1e4c383b510f990a752151ba209ab020 | Antti Keränen | 2015-07-16T08:52:10 | Wasn't aware of Doc-tests | diff --git a/src/lib.rs b/src/lib.rs
index 685a3d8..a0ed9cf 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -67,6 +67,7 @@ impl CtrlC {
/// Sets up the signal handler for Ctrl-C
/// # Example
/// ```
+ /// use ctrlc::CtrlC;
/// CtrlC::set_handler(|| println!("Hello world!"));
/// ```
pub fn... | 1 | 1 | 0 |
262a41b55901cfe745d0c7fbabc18e3ac46522f9 | Antti Keränen | 2015-07-16T08:48:04 | Reduced amount of keywords as 5 is the maximum | diff --git a/Cargo.toml b/Cargo.toml
index 55fe566..cb82423 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -4,7 +4,7 @@ name = "ctrlc"
version = "0.1.0"
authors = ["Antti Keränen <detegr@gmail.com>"]
license = "MIT"
-keywords = ["ctrlc", "ctrl", "ctrl-c", "control", "signal", "SIGINT", "SetConsoleCtrlHandler"]
+keyword... | 1 | 1 | 1 |
cdda8681114bd2869eb7d153aa6c0be17fdb121b | Antti Keränen | 2015-07-16T08:44:31 | Specified versions of dependencies | diff --git a/Cargo.toml b/Cargo.toml
index 077f7ca..55fe566 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -10,10 +10,10 @@ homepage = "https://github.com/Detegr/rust-ctrlc"
repository = "https://github.com/Detegr/rust-ctrlc.git"
[dependencies]
-libc = "*"
+libc = "0.1"
[dependencies.lazy_static]
-version = "*"
+ve... | 1 | 2 | 2 |
a36f98b4607a71a37808524c0f11e0fd1630d877 | Antti Keränen | 2015-07-16T08:42:28 | Added the most simple example possible | diff --git a/examples/simple.rs b/examples/simple.rs
new file mode 100644
index 0000000..380f3f0
--- /dev/null
+++ b/examples/simple.rs
@@ -0,0 +1,6 @@
+extern crate ctrlc;
+use ctrlc::CtrlC;
+fn main() {
+ CtrlC::set_handler(|| println!("Hello world!"));
+ loop {}
+} | 1 | 6 | 0 |
70bf3bceffcf250b5ee7851138f5f32c589e61d5 | Antti Keränen | 2015-07-16T08:41:41 | Added a short documentation | diff --git a/src/lib.rs b/src/lib.rs
index 7bcabb0..685a3d8 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,3 +1,5 @@
+//! A simple easy to use wrapper around Ctrl-C signal.
+
#![cfg_attr(feature="nightly", feature(static_condvar))]
#![cfg_attr(feature="nightly", feature(static_mutex))]
@@ -20,7 +22,7 @@ mod feature... | 1 | 8 | 1 |
2ed602cf598540502d04efc8b615569420d00219 | Antti Keränen | 2015-07-16T08:27:26 | Update Cargo.toml | diff --git a/Cargo.toml b/Cargo.toml
index b20aecf..077f7ca 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -4,8 +4,8 @@ name = "ctrlc"
version = "0.1.0"
authors = ["Antti Keränen <detegr@gmail.com>"]
license = "MIT"
-keywords = ["ctrl", "control", "signal", "SIGINT"]
-description = "Easy ctrl-c handler for Rust project... | 1 | 2 | 2 |
6e225e55a011118d3e9ae1367ad19fd20f25e0d5 | Antti Keränen | 2015-07-16T08:20:59 | Now supporting stable and beta compilers | diff --git a/Cargo.toml b/Cargo.toml
index 785df18..b20aecf 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,5 +12,11 @@ repository = "https://github.com/Detegr/rust-ctrlc.git"
[dependencies]
libc = "*"
+[dependencies.lazy_static]
+version = "*"
+optional = true
+
[features]
+default = ["stable"]
nightly = []
+sta... | 2 | 33 | 16 |
8ac0d486338944fa9e87dbdd5a62920b5025df79 | Antti Keränen | 2015-07-16T08:09:06 | Started adding support for stable compiler | diff --git a/Cargo.toml b/Cargo.toml
index 6f1a597..785df18 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,3 +11,6 @@ repository = "https://github.com/Detegr/rust-ctrlc.git"
[dependencies]
libc = "*"
+
+[features]
+nightly = []
diff --git a/src/lib.rs b/src/lib.rs
index 5742204..b24c507 100644
--- a/src/lib.rs
+++... | 2 | 30 | 23 |
f8362dffa63c490aabff2725040bde88140e22b4 | Antti Keränen | 2015-07-16T07:20:31 | Removed obsolete attribute from struct CtrlC | diff --git a/src/lib.rs b/src/lib.rs
index 1fcbc95..5742204 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -45,9 +45,7 @@ mod platform {
}
use self::platform::*;
-#[allow(missing_copy_implementations)]
pub struct CtrlC;
-
impl CtrlC {
pub fn set_handler<F: Fn() -> () + 'static + Send>(user_handler: F) -> () {
... | 1 | 0 | 2 |
9f233a61979e11d0e219cc559d14355b5bfadb33 | Antti Keränen | 2015-07-16T07:18:58 | Fix Windows build | diff --git a/src/lib.rs b/src/lib.rs
index fe5bd65..1fcbc95 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -25,6 +25,7 @@ mod platform {
}
#[cfg(windows)]
mod platform {
+ use libc::c_int;
type PHandlerRoutine = unsafe extern fn(CtrlType: c_int) -> bool;
#[link(name = "kernel32")]
@@ -34,12 +35,12 @@ mod... | 1 | 4 | 3 |
75a6b9269cf98d819b155b334945cbb7144988ff | Antti Keränen | 2015-07-16T07:11:19 | Cleaned up the implementations of different platforms | diff --git a/src/lib.rs b/src/lib.rs
index c2f0f76..fe5bd65 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -3,65 +3,54 @@
extern crate libc;
-#[cfg(unix)]
-use libc::types::os::common::posix01::sighandler_t;
-#[cfg(unix)]
-use libc::consts::os::posix88::SIGINT;
-#[cfg(unix)]
-use libc::funcs::posix01::signal::signal;... | 1 | 32 | 43 |
fda746ccc14b0a5c81bc7e02198006323795b421 | Antti Keränen | 2015-07-16T06:51:07 | Removed unused feature | diff --git a/src/lib.rs b/src/lib.rs
index e77074b..c2f0f76 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,4 +1,3 @@
-#![feature(std_misc)]
#![feature(static_condvar)]
#![feature(static_mutex)] | 1 | 0 | 1 |
46ffb648c834d279ee46823c72471117df2ee46a | Antti Keränen | 2015-07-15T19:29:17 | Added the example from README to examples | diff --git a/examples/readme_example.rs b/examples/readme_example.rs
new file mode 100644
index 0000000..f81727a
--- /dev/null
+++ b/examples/readme_example.rs
@@ -0,0 +1,15 @@
+extern crate ctrlc;
+use ctrlc::CtrlC;
+use std::sync::atomic::{AtomicBool, Ordering};
+use std::sync::Arc;
+
+fn main() {
+ let running = ... | 1 | 15 | 0 |
d07442996b6377b148d5f150cc95a16941439351 | Antti Keränen | 2015-05-16T18:02:24 | feature(static_condvar) | diff --git a/src/lib.rs b/src/lib.rs
index 3128dbb..4fbf8d0 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,5 +1,6 @@
#![feature(libc)]
#![feature(std_misc)]
+#![feature(static_condvar)]
extern crate libc;
use libc::types::os::common::posix01::sighandler_t; | 1 | 1 | 0 |
5bcb61a4a57fa3b4c8989143729aac45c00259b1 | Antti Keränen | 2015-04-29T13:37:57 | Update to latest Rust version | diff --git a/Cargo.toml b/Cargo.toml
index 4c01516..86d9397 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
-name = "rust-ctrlc"
+name = "ctrlc"
version = "0.0.1"
authors = ["Antti Keränen <detegr@gmail.com>"]
license = "MIT"
diff --git a/src/lib.rs b/src/lib.rs
index cbfc4c6..3128dbb 100644
--... | 2 | 3 | 4 |
31ea2a244aa4ccd5954af544998426be13392341 | nmlgc | 2018-07-06T13:07:32 | Test SequenceMatcher with integer slices | diff --git a/tests/tests.rs b/tests/tests.rs
index f01a315..8f49de9 100644
--- a/tests/tests.rs
+++ b/tests/tests.rs
@@ -173,3 +173,22 @@ fn test_context_diff() {
zero one! tree four"
);
}
+
+#[test]
+fn test_integer_slice() {
+ let s1 = vec![1, 2, 3, 4, 5];
+ let s2 = vec![5, 4, 3, 2, 1];
+ ... | 1 | 19 | 0 |
de82e46021d1a770ec6ac8de7ada63bb14eb9028 | nmlgc | 2018-07-02T18:09:51 | Apply all Clippy lints that don't break the API | diff --git a/src/differ.rs b/src/differ.rs
index 6eb5eba..6b87e01 100644
--- a/src/differ.rs
+++ b/src/differ.rs
@@ -2,6 +2,7 @@ use sequencematcher::SequenceMatcher;
use std::cmp;
use utils::{count_leading, str_with_similar_chars};
+#[derive(Default)]
pub struct Differ {
pub line_junk: Option<fn(&str) -> boo... | 4 | 73 | 78 |
282c139cc03efbee6ff766b6b3af97ac6c988c76 | nmlgc | 2018-07-01T16:41:22 | Remove generic types from Differ
The entire implementation pretty much only makes sense for string
slices, and that was all the original code supported anyway. | diff --git a/src/differ.rs b/src/differ.rs
index a021e2f..6eb5eba 100644
--- a/src/differ.rs
+++ b/src/differ.rs
@@ -1,4 +1,4 @@
-use sequencematcher::{Sequence, SequenceMatcher};
+use sequencematcher::SequenceMatcher;
use std::cmp;
use utils::{count_leading, str_with_similar_chars};
@@ -15,11 +15,7 @@ impl Differ ... | 2 | 32 | 31 |
e2bbf92e4cf849042f290d2ecfef82da002e8f37 | nmlgc | 2018-06-30T10:40:50 | chain_second_seq(): Filter out junk and popular elements in a more idiomatic way | diff --git a/src/sequencematcher.rs b/src/sequencematcher.rs
index 5555565..0dc645b 100644
--- a/src/sequencematcher.rs
+++ b/src/sequencematcher.rs
@@ -1,5 +1,5 @@
use std::cmp::{max, min};
-use std::collections::{HashMap, HashSet};
+use std::collections::HashMap;
use std::fmt::Debug;
use utils::calculate_ratio;
... | 1 | 11 | 20 |
63e214364aecaa7143c0ee4eeaa4e332e67cecff | nmlgc | 2018-06-29T09:58:31 | Remove second_sequence_popular from the SequenceMatcher struct.
It's never read from. | diff --git a/src/sequencematcher.rs b/src/sequencematcher.rs
index 1800ac7..5555565 100644
--- a/src/sequencematcher.rs
+++ b/src/sequencematcher.rs
@@ -111,7 +111,6 @@ pub struct SequenceMatcher<'a, T: 'a + ?Sized + Sequence> {
opcodes: Option<Vec<Opcode>>,
is_junk: Option<fn(&str) -> bool>,
second_sequ... | 1 | 0 | 3 |
e36a1d4645db54baf199a98e75ac66841fdf393d | nmlgc | 2018-06-28T11:19:50 | Fix mutability warnings | diff --git a/src/sequencematcher.rs b/src/sequencematcher.rs
index 4444baf..1800ac7 100644
--- a/src/sequencematcher.rs
+++ b/src/sequencematcher.rs
@@ -347,12 +347,12 @@ impl<'a, T: ?Sized + Sequence> SequenceMatcher<'a, T> {
}
if codes.first().unwrap().tag == "equal" {
- let mut opcode ... | 1 | 2 | 2 |
41c8240cb748570c5d986307b0367eb4a6438ef4 | Dima Kudosh | 2018-03-24T15:01:27 | Replaced Vec with HashSet for second_sequence_popular | diff --git a/Cargo.toml b/Cargo.toml
index 7d41f69..13fce5e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "difflib"
-version = "0.3.0"
+version = "0.3.1"
authors = ["Dima Kudosh <dimakudosh@gmail.com>"]
description = "Port of Python's difflib library to Rust."
documentation = "https://g... | 2 | 6 | 6 |
76384c2568a927c6b864a3b4be52d66cc7127cca | Armin Ronacher | 2017-07-12T18:14:01 | Fixed a bug with subtraction in the opcode code | diff --git a/src/sequencematcher.rs b/src/sequencematcher.rs
index 2a3da07..bb30cee 100644
--- a/src/sequencematcher.rs
+++ b/src/sequencematcher.rs
@@ -337,8 +337,8 @@ Opcode::new(String::from("equal"), m.first_start, i, m.second_start, j)
if codes.first().unwrap().tag == "equal" {
let mut opco... | 1 | 4 | 4 |
7fc731ab99f2df409ab6b5490780986036accd14 | Dima Kudosh | 2017-01-16T12:58:25 | update version | diff --git a/Cargo.toml b/Cargo.toml
index a8abd5a..4643ec9 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "difflib"
-version = "0.1.0"
+version = "0.2.0"
authors = ["Dima Kudosh <dimakudosh@gmail.com>"]
description = "Port of Python's difflib library to Rust."
documentation = "https://g... | 1 | 1 | 1 |
5975412d97d9752f682219959892455d98c0fc3e | Shawn Walker-Salas | 2017-01-12T06:32:21 | Update sequencematcher.rs | diff --git a/src/sequencematcher.rs b/src/sequencematcher.rs
index 6bccd52..26c3bf6 100644
--- a/src/sequencematcher.rs
+++ b/src/sequencematcher.rs
@@ -74,6 +74,32 @@ impl<'a> Sequence for Vec<&'a str> {
}
}
+impl Sequence for String {
+ fn len(&self) -> usize {
+ self.len()
+ }
+
+ fn at_index... | 1 | 26 | 0 |
900da83d59d52b18efc880dadd79107b4e76cc89 | Dima Kudosh | 2016-07-02T18:10:52 | Rename test.rs to tests.rs | diff --git a/tests/test.rs b/tests/tests.rs
similarity index 99%
rename from tests/test.rs
rename to tests/tests.rs
index 4f4c604..28d704c 100644
--- a/tests/test.rs
+++ b/tests/tests.rs
@@ -145,4 +145,4 @@ fn test_context_diff() {
let result = difflib::context_diff(&first_text, &second_text, "Original", "Current",
... | 1 | 1 | 1 |
063536e70347ec027bb141653d0ec875229534ba | Dima Kudosh | 2016-03-01T20:12:48 | Update Cargo.toml | diff --git a/Cargo.toml b/Cargo.toml
index e3650a6..a8abd5a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -2,3 +2,18 @@
name = "difflib"
version = "0.1.0"
authors = ["Dima Kudosh <dimakudosh@gmail.com>"]
+description = "Port of Python's difflib library to Rust."
+documentation = "https://github.com/DimaKudosh/difflib/... | 1 | 15 | 0 |
16fc483ea1cff63dccbd7db70a7dec46051d7f4b | Dima Kudosh | 2016-03-01T12:00:07 | Remove warnings | diff --git a/src/differ.rs b/src/differ.rs
index 8721d76..66caa0c 100644
--- a/src/differ.rs
+++ b/src/differ.rs
@@ -53,8 +53,8 @@ impl Differ{
if !(first_start < first_end && second_start < second_end){
return Vec::new();
}
- let mut first = Vec::new();
- let mut second = Vec::new();
+ let mut first;
+ l... | 3 | 7 | 8 |
ef70f2450e98cf424b46cec426ed5216b8914089 | Dima Kudosh | 2016-03-01T11:51:36 | Remove lineterm in contextt_diff and unified_diff | diff --git a/examples/example.rs b/examples/example.rs
index c4a8aff..a97c6ea 100644
--- a/examples/example.rs
+++ b/examples/example.rs
@@ -9,14 +9,14 @@ fn main() {
let first_text = "one two three four".split(" ").collect::<Vec<&str>>();
let second_text = "zero one tree four".split(" ").collect::<Vec<&str>>();
... | 3 | 10 | 8 |
963a917bf7c6544ea19f8afb66edcc863e5cb6d0 | Dima Kudosh | 2016-02-29T11:39:28 | Remove Sequence trait implementation for array | diff --git a/src/sequencematcher.rs b/src/sequencematcher.rs
index 1030890..e47a5d6 100644
--- a/src/sequencematcher.rs
+++ b/src/sequencematcher.rs
@@ -74,19 +74,6 @@ impl<'a> Sequence for Vec<&'a str> {
}
}
-impl<'a> Sequence for [&'a str] {
- fn len(&self) -> usize {
- self.len()
- }
-
- fn at_index(&self, ind... | 1 | 0 | 13 |
0035a1b81670d484793155f32a62e389239e6fd2 | Dima Kudosh | 2016-02-29T11:05:31 | Change spaces to tab | diff --git a/examples/example.rs b/examples/example.rs
index 289a6dd..c4a8aff 100644
--- a/examples/example.rs
+++ b/examples/example.rs
@@ -5,46 +5,46 @@ use difflib::sequencematcher::SequenceMatcher;
fn main() {
- // unified_diff
- let first_text = "one two three four".split(" ").collect::<Vec<&str>>();
- ... | 5 | 448 | 448 |
208671babd934487abbc4f0bf224199094f6126e | Dima Kudosh | 2016-02-28T19:33:35 | Add example | diff --git a/examples/example.rs b/examples/example.rs
new file mode 100644
index 0000000..289a6dd
--- /dev/null
+++ b/examples/example.rs
@@ -0,0 +1,50 @@
+extern crate difflib;
+
+use difflib::differ::Differ;
+use difflib::sequencematcher::SequenceMatcher;
+
+
+fn main() {
+ // unified_diff
+ let first_text = "... | 3 | 64 | 1 |
a99af75280cdd31f21818f5d6e8416db56b294bb | Dima Kudosh | 2016-02-28T18:35:03 | Add ability to specify user-defined functions for matcher | diff --git a/src/differ.rs b/src/differ.rs
index 7c34d37..8143098 100644
--- a/src/differ.rs
+++ b/src/differ.rs
@@ -4,20 +4,21 @@ use std::cmp;
pub struct Differ {
- linejunk: Option<String>,
- charjunk: Option<String>
+ pub line_junk: Option<fn(&str) -> bool>,
+ pub char_junk: Option<fn(&str) -> bool... | 5 | 51 | 30 |
b2e0c729ff737ec5a5deccf68a1986fba0a1e3e3 | Dima Kudosh | 2016-02-28T16:47:48 | Add ability to restore sequence after differ | diff --git a/src/differ.rs b/src/differ.rs
index 77d916b..7c34d37 100644
--- a/src/differ.rs
+++ b/src/differ.rs
@@ -181,6 +181,28 @@ impl Differ{
res
}
+ pub fn restore(delta: &Vec<String>, which: usize) -> Vec<String> {
+ if !(which == 1 || which == 2) {
+ panic!("Second parameter... | 3 | 33 | 1 |
3781894ffc29456c5039daddab9482a02a70dd82 | Dima Kudosh | 2016-02-28T16:14:11 | Add context diff and tests for it | diff --git a/src/lib.rs b/src/lib.rs
index 38082df..52c2150 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -3,8 +3,9 @@ pub mod differ;
mod utils;
+use std::collections::HashMap;
use sequencematcher::{SequenceMatcher, Sequence};
-use utils::{format_range_unified};
+use utils::{format_range_unified, format_range_cont... | 3 | 85 | 2 |
0fa2c80be0853c66bbb31038dd42411b3b61e3f5 | Dima Kudosh | 2016-02-28T15:24:03 | Add unified diff and tests for it | diff --git a/src/lib.rs b/src/lib.rs
index 263a75a..38082df 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -3,7 +3,7 @@ pub mod differ;
mod utils;
-use sequencematcher::SequenceMatcher;
+use sequencematcher::{SequenceMatcher, Sequence};
use utils::{format_range_unified};
@@ -24,9 +24,9 @@ pub fn get_close_matche... | 4 | 24 | 34 |
2d309c0ba4bf0b6f7378e75500fc36bf295147e2 | Dima Kudosh | 2016-02-28T14:38:44 | Add new tests, fix bugs with Differ | diff --git a/src/differ.rs b/src/differ.rs
index ee016a0..77d916b 100644
--- a/src/differ.rs
+++ b/src/differ.rs
@@ -16,18 +16,22 @@ impl Differ{
}
}
- pub fn compare<T: ?Sized + Sequence>(&self, first_sequence: &T, second_sequence: &T) -> Vec<Vec<String>> {
+ pub fn compare<T: ?Sized + Sequence>(&self, first_se... | 3 | 135 | 48 |
53553047df066428324d49a1968aa0c1d199f108 | Dima Kudosh | 2016-02-27T18:56:16 | Wrote some tests | diff --git a/tests/test.rs b/tests/test.rs
new file mode 100644
index 0000000..40dcb06
--- /dev/null
+++ b/tests/test.rs
@@ -0,0 +1,38 @@
+extern crate difflib;
+
+use difflib::sequencematcher::{SequenceMatcher, Match};
+
+
+#[test]
+fn test_longest_match()
+{
+ let matcher = SequenceMatcher::new(" abcd", "abcd abcd");... | 1 | 38 | 0 |
792515fb0d392e416e79c52081fd2e125dee5c47 | Dima Kudosh | 2016-02-27T18:55:43 | Change algorithm for finding largest common sequence, change SequenceMatcher to generic | diff --git a/src/differ.rs b/src/differ.rs
index c89d6fe..ee016a0 100644
--- a/src/differ.rs
+++ b/src/differ.rs
@@ -1,5 +1,5 @@
-use sequencematcher::SequenceMatcher;
-use utils::{slice_str, str_with_similar_chars, count_leading};
+use sequencematcher::{SequenceMatcher, Sequence};
+use utils::{str_with_similar_chars, ... | 4 | 230 | 117 |
43a88b17b2f5e0405beff3d55ef5cdb7e6f09d10 | Dima Kudosh | 2016-02-18T10:59:47 | Add function to get grouping opcodes for sequence matcher struct | diff --git a/src/sequencematcher.rs b/src/sequencematcher.rs
index 127455b..f924f47 100644
--- a/src/sequencematcher.rs
+++ b/src/sequencematcher.rs
@@ -1,4 +1,4 @@
-use std::cmp::Ordering;
+use std::cmp::{Ordering, max, min};
use utils::{slice_str, calculate_ratio};
#[derive(Debug, Clone, Copy)]
@@ -207,6 +207,68 ... | 1 | 63 | 1 |
02d2d1762d74fd343f2b982909b86505ba0e6b9f | Dima Kudosh | 2016-02-18T10:05:52 | Implement differ struct | diff --git a/src/differ.rs b/src/differ.rs
index 33326e3..c89d6fe 100644
--- a/src/differ.rs
+++ b/src/differ.rs
@@ -1,5 +1,6 @@
use sequencematcher::SequenceMatcher;
-use utils::{slice_str, str_with_similar_chars};
+use utils::{slice_str, str_with_similar_chars, count_leading};
+use std::cmp;
pub struct Differ {... | 2 | 47 | 16 |
b595d39f02946829b9d75f80f66756206825a42c | Dima Kudosh | 2016-02-17T18:44:05 | Add function to get closest word for specified word in words array | diff --git a/src/lib.rs b/src/lib.rs
index 9326999..7f9a8db 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,3 +1,25 @@
pub mod sequencematcher;
pub mod differ;
-mod utils;
\ No newline at end of file
+mod utils;
+
+
+use sequencematcher::SequenceMatcher;
+
+
+pub fn get_close_matches<'a>(word: &str, possibilities: Vec... | 1 | 23 | 1 |
38cc286ba29b4064dfe6b6b9e49ed606ae1062bf | Dima Kudosh | 2016-02-17T18:03:12 | Partly implement differ struce, add Opcode struct | diff --git a/src/differ.rs b/src/differ.rs
index 05439c6..33326e3 100644
--- a/src/differ.rs
+++ b/src/differ.rs
@@ -1,4 +1,5 @@
use sequencematcher::SequenceMatcher;
+use utils::{slice_str, str_with_similar_chars};
pub struct Differ {
@@ -13,4 +14,144 @@ impl Differ{
charjunk: None
}
}
+
+ pub fn compar... | 3 | 201 | 7 |
ca75fcc86288f689ff85601f4caa8e0ae59ac800 | Dima Kudosh | 2016-02-15T12:05:54 | Add Differ | diff --git a/src/differ.rs b/src/differ.rs
new file mode 100644
index 0000000..05439c6
--- /dev/null
+++ b/src/differ.rs
@@ -0,0 +1,16 @@
+use sequencematcher::SequenceMatcher;
+
+
+pub struct Differ {
+ linejunk: Option<String>,
+ charjunk: Option<String>
+}
+
+impl Differ{
+ pub fn new() -> Differ {
+ Differ{
... | 2 | 17 | 0 |
6bd7dc4b84323ade12c4eb43899f14de90997288 | Dima Kudosh | 2016-02-15T11:54:32 | Add ability to calculate ratio | diff --git a/src/sequencematcher.rs b/src/sequencematcher.rs
index 43d4b6c..9f51d80 100644
--- a/src/sequencematcher.rs
+++ b/src/sequencematcher.rs
@@ -1,5 +1,5 @@
use std::cmp::Ordering;
-use utils::slice_str;
+use utils::{slice_str, calculate_ratio};
#[derive(Debug, Clone, Copy)]
pub struct Match{
@@ -162,4 +16... | 2 | 14 | 1 |
329dc4419a6d84cb886f0c0601b0ef96348750a5 | Dima Kudosh | 2016-02-15T11:42:01 | Fix bug with last match in get_matching_blocks. Add opcodes | diff --git a/src/sequencematcher.rs b/src/sequencematcher.rs
index 93cdca4..43d4b6c 100644
--- a/src/sequencematcher.rs
+++ b/src/sequencematcher.rs
@@ -28,25 +28,35 @@ impl PartialEq for Match {
impl Eq for Match { }
+impl Match{
+ fn new(first_start: usize, second_start: usize, size: usize) -> Match {
+ Match{
... | 1 | 53 | 10 |
26d8f5f78e2d6f136c8d420714a9fa55ecae8ee7 | Dima Kudosh | 2016-02-15T10:51:29 | Add ability to get all common sequences | diff --git a/src/lib.rs b/src/lib.rs
index b76a9b4..3126c64 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1 +1,2 @@
-pub mod sequencematcher;
\ No newline at end of file
+pub mod sequencematcher;
+mod utils;
\ No newline at end of file
diff --git a/src/sequencematcher.rs b/src/sequencematcher.rs
index 8cafd08..93cdca4 1... | 3 | 104 | 21 |
302257e54ae4bd57d1fde68f67ed9eb934323b76 | Dima Kudosh | 2016-02-13T10:38:17 | Add Sequence Matcher, add ability to find largest common sequence | diff --git a/Cargo.toml b/Cargo.toml
index 40bfcb3..e3650a6 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,4 +1,4 @@
[package]
name = "difflib"
version = "0.1.0"
-authors = ["Dima Kudosh <LagMegantic@yandex.ru>"]
+authors = ["Dima Kudosh <dimakudosh@gmail.com>"]
diff --git a/src/lib.rs b/src/lib.rs
index a93251b..b7... | 3 | 54 | 4 |
d01307bbfc9750824b8fcc49cb616f8e85064c5a | Dima Kudosh | 2016-02-12T16:17:34 | Initial commit | diff --git a/Cargo.toml b/Cargo.toml
new file mode 100644
index 0000000..40bfcb3
--- /dev/null
+++ b/Cargo.toml
@@ -0,0 +1,4 @@
+[package]
+name = "difflib"
+version = "0.1.0"
+authors = ["Dima Kudosh <LagMegantic@yandex.ru>"]
diff --git a/src/lib.rs b/src/lib.rs
new file mode 100644
index 0000000..a93251b
--- /dev/nul... | 2 | 7 | 0 |
a6c62cf4c820885887c6ac20931bb0edc32bb917 | DoumanAsh | 2025-12-02T23:52:35 | renew codebase | diff --git a/src/lib.rs b/src/lib.rs
index 8ca40fc..89fcfc6 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -15,7 +15,7 @@
#![no_std]
#![warn(missing_docs)]
-#![cfg_attr(feature = "cargo-clippy", allow(clippy::style))]
+#![allow(clippy::style)]
#[cfg(feature = "std")]
extern crate std;
diff --git a/src/posix.rs b/s... | 3 | 25 | 4 |
80cdefff6552b95750221bd2bb8fad100fd41e9a | solomoncyj | 2025-05-06T02:18:28 | add License files to include | diff --git a/Cargo.toml b/Cargo.toml
index 18b69f1..4495bf6 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -10,7 +10,8 @@ readme = "README.md"
include = [
"**/*.rs",
"Cargo.toml",
- "README.md"
+ "README.md",
+ "LICENSE"
]
[features] | 1 | 2 | 1 |
bb55007f2b8c948b268c2e0fba9d770c33438a45 | DoumanAsh | 2024-09-10T00:06:59 | 3.3.1: Fix min rust version jump | diff --git a/Cargo.toml b/Cargo.toml
index c22e480..18b69f1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "error-code"
-version = "3.3.0"
+version = "3.3.1"
authors = ["Douman <douman@gmx.se>"]
edition = "2018"
description = "Error code"
diff --git a/src/lib.rs b/src/lib.rs
index 18173e... | 2 | 2 | 2 |
7fd40bc1fbf70c27a707142f9d5515ec1e8e2a00 | DoumanAsh | 2024-09-10T00:01:18 | 3.3.0: Refactoring Debug impl | diff --git a/Cargo.toml b/Cargo.toml
index 6013c85..c22e480 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "error-code"
-version = "3.2.0"
+version = "3.3.0"
authors = ["Douman <douman@gmx.se>"]
edition = "2018"
description = "Error code"
diff --git a/src/lib.rs b/src/lib.rs
index e036ff... | 2 | 5 | 5 |
f14a8af3572c1543c13e02ff78cfe6e2d0a67c93 | DoumanAsh | 2024-02-27T15:20:49 | Add macro to generate error code enum | diff --git a/src/lib.rs b/src/lib.rs
index 8c11d44..1511454 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -27,18 +27,148 @@ pub const UNKNOWN_ERROR: &str = "Unknown error";
///Text to return when error fails to be converted into utf-8
pub const FAIL_ERROR_FORMAT: &str = "Failed to format error into utf-8";
-const MES... | 2 | 145 | 8 |
b44caf01a1e7d45de3e47cff9f67b8126b1a7ff6 | DoumanAsh | 2024-02-25T03:41:57 | Use errno_location for WASI | diff --git a/src/posix.rs b/src/posix.rs
index fd5c792..a3bb6d1 100644
--- a/src/posix.rs
+++ b/src/posix.rs
@@ -31,7 +31,8 @@ pub(crate) fn get_last_error() -> c_int {
target_os = "fuchsia",
target_os = "l4re",
target_os = "hurd",
- target_os = "teeos"
... | 1 | 4 | 2 |
fd5c713313847182ab4784af285c57209958ffc4 | DoumanAsh | 2024-02-25T03:30:34 | Refactoring errno function to make it less error prone | diff --git a/src/posix.rs b/src/posix.rs
index 80d19e3..fd5c792 100644
--- a/src/posix.rs
+++ b/src/posix.rs
@@ -18,84 +18,82 @@ fn equivalent(code: c_int, other: &ErrorCode) -> bool {
ptr::eq(&POSIX_CATEGORY, other.category()) && code == other.raw_code()
}
+#[cfg(not(any(target_os = "wasi", target_os = "clouda... | 1 | 64 | 66 |
d22dfc0a195ca20432e865b3e89fffbf5bcf9454 | DoumanAsh | 2024-02-25T03:25:29 | Errno location for dragonfly and teeos | diff --git a/src/posix.rs b/src/posix.rs
index dcbbc64..80d19e3 100644
--- a/src/posix.rs
+++ b/src/posix.rs
@@ -32,6 +32,7 @@ pub(crate) fn get_last_error() -> c_int {
target_os = "fuchsia",
target_os = "l4re",
target_os = "hurd",
+ targ... | 1 | 2 | 12 |
4bcfc034cf5681a112d7c69dfc2fe539b6157fd3 | DoumanAsh | 2024-02-25T03:15:08 | Update errno location from rustc code base | diff --git a/src/posix.rs b/src/posix.rs
index 8af6699..dcbbc64 100644
--- a/src/posix.rs
+++ b/src/posix.rs
@@ -21,30 +21,44 @@ fn equivalent(code: c_int, other: &ErrorCode) -> bool {
pub(crate) fn get_last_error() -> c_int {
#[cfg(not(any(target_os = "wasi", target_os = "cloudabi", target_os = "unknown")))]
... | 1 | 26 | 12 |
74910bfbb9fdb23e48cafcd78a4f7f709000e73d | DoumanAsh | 2023-09-30T11:48:58 | 3.0.0: Prepare release | diff --git a/Cargo.toml b/Cargo.toml
index 82fe854..5cc06c1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "error-code"
-version = "3.0.0-beta.6"
+version = "3.0.0"
authors = ["Douman <douman@gmx.se>"]
edition = "2018"
description = "Error code"
diff --git a/src/lib.rs b/src/lib.rs
index... | 2 | 45 | 2 |
7dd55c698b27ff0a99a617e1e932fa94bb97a375 | DoumanAsh | 2023-09-30T11:26:58 | Refactoring fmt::Display | diff --git a/src/lib.rs b/src/lib.rs
index 9b34218..9a34657 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -155,11 +155,12 @@ impl fmt::Debug for ErrorCode {
}
impl fmt::Display for ErrorCode {
- #[inline]
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut out = [mem::MaybeUninit::un... | 1 | 3 | 2 |
0665731b529a4771cf65feb328402f58d01223af | DoumanAsh | 2023-09-30T08:48:26 | would_block tests | diff --git a/tests/error_code.rs b/tests/error_code.rs
index 01aabed..2b48607 100644
--- a/tests/error_code.rs
+++ b/tests/error_code.rs
@@ -1,7 +1,26 @@
-use error_code::ErrorCode;
+use error_code::{ErrorCode, defs};
use core::mem;
+#[test]
+fn check_would_block() {
+ let mut error = ErrorCode::new_posix(defs:... | 1 | 34 | 1 |
fd0d3e81846f7d5c26fa28066ef1f3b5e242f960 | DoumanAsh | 2023-09-29T11:43:03 | Add errno for newlib env | diff --git a/src/defs.rs b/src/defs.rs
index adfa550..1e9ce82 100644
--- a/src/defs.rs
+++ b/src/defs.rs
@@ -1,5 +1,6 @@
//! Definitions used by this library
+#[allow(unused)]
use crate::types::c_int;
#[cfg(any(target_env = "wasi", target_os = "wasi"))]
diff --git a/src/posix.rs b/src/posix.rs
index a15db3f..8af... | 2 | 13 | 1 |
49a21f15062ef5239f9fbef9e83f028ed2185e36 | DoumanAsh | 2023-09-29T11:20:21 | 3.0.0-beta.6: Remove libc | diff --git a/Cargo.toml b/Cargo.toml
index 859529c..82fe854 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "error-code"
-version = "3.0.0-beta.5"
+version = "3.0.0-beta.6"
authors = ["Douman <douman@gmx.se>"]
edition = "2018"
description = "Error code"
@@ -13,10 +13,6 @@ include = [
... | 4 | 110 | 6 |
8e025439c35f49969a78780a172abc530bacef0f | DoumanAsh | 2023-09-29T01:19:46 | Expose types module | diff --git a/src/lib.rs b/src/lib.rs
index fdaaaf8..d787638 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -31,7 +31,7 @@ const MESSAGE_BUF_SIZE: usize = 256;
///Type alias for buffer to hold error code description.
pub type MessageBuf = [mem::MaybeUninit<u8>; MESSAGE_BUF_SIZE];
-mod types;
+pub mod types;
mod utils;... | 2 | 8 | 2 |
66d211e973a3b0c373f01d5112af6a71657422d1 | DoumanAsh | 2023-09-29T00:11:37 | Remove libc for integer types by copy-pasting it from rust sources | diff --git a/src/system.rs b/src/system.rs
index 008acd0..56b5dec 100644
--- a/src/system.rs
+++ b/src/system.rs
@@ -36,21 +36,21 @@ fn message(code: c_int, out: &mut crate::MessageBuf) -> &str {
use crate::MESSAGE_BUF_SIZE;
use core::{slice, mem};
- const CP_UTF8: u32 = 65001;
- const FORMAT_MESSAGE_... | 2 | 31 | 21 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.