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 |
|---|---|---|---|---|---|---|---|
c584d9726dcab01706e2cab9a769cce6cdef2d45 | Xudong Huang | 2015-11-10T14:25:02 | move Gn to gen_impl.rs | diff --git a/src/gen_impl.rs b/src/gen_impl.rs
index f069eaa..cbfd8ea 100644
--- a/src/gen_impl.rs
+++ b/src/gen_impl.rs
@@ -8,6 +8,7 @@ use std::mem;
use std::thread;
use std::any::Any;
use std::boxed::FnBox;
+use std::marker::PhantomData;
use yield_::yield_now;
use generator::Generator;
@@ -16,32 +17,26 @@ use... | 3 | 47 | 51 |
e39e6e4889baa2c8057d8f50bfee9b0326a9e549 | Xudong Huang | 2015-11-06T09:15:48 | refine default stack size | diff --git a/src/gen_impl.rs b/src/gen_impl.rs
index e4bfa3d..f069eaa 100644
--- a/src/gen_impl.rs
+++ b/src/gen_impl.rs
@@ -15,8 +15,6 @@ use rt::{Error, Context, ContextStack};
use reg_context::Context as RegContext;
// use stack_size::{get_stack_size, set_stack_size};
-// default stack size is 1k * sizeof(usize)... | 4 | 13 | 10 |
1f3da4371cf2191f58c863d7c327f3264290e68b | Xudong Huang | 2015-11-07T10:22:09 | use PhantomData as dummy | diff --git a/src/generator.rs b/src/generator.rs
index 7ea26fa..5aa627d 100644
--- a/src/generator.rs
+++ b/src/generator.rs
@@ -4,6 +4,7 @@
//!
use std::any::Any;
+use std::marker::PhantomData;
use gen_impl::GeneratorImpl;
@@ -31,12 +32,11 @@ pub trait Generator<A> {
fn stack_usage(&self) -> (usize, usiz... | 1 | 2 | 2 |
f9a15cb49c15f777affe1857b87ddbffc327ed64 | Xudong Huang | 2015-11-05T10:37:11 | refine stack_size | diff --git a/src/gen_impl.rs b/src/gen_impl.rs
index 811628a..e4bfa3d 100644
--- a/src/gen_impl.rs
+++ b/src/gen_impl.rs
@@ -120,7 +120,7 @@ impl<A: Any, T: Any, F> Drop for GeneratorImpl<A, T, F>
if used_stack < total_stack {
// here we should record the stack in the class
// next ti... | 2 | 16 | 6 |
6f31659d779912215fa90eee56cf3e29c927c233 | Xudong Huang | 2015-11-05T10:01:07 | only 'static closure support stack size record | diff --git a/examples/stack_resize.rs b/examples/stack_resize.rs
index 2523c14..7418f1d 100644
--- a/examples/stack_resize.rs
+++ b/examples/stack_resize.rs
@@ -19,17 +19,17 @@ fn get_gen() -> Box<Generator<(), Output = u32>> {
}
fn main() {
- let g = get_gen();
- println!("stack size is: {}", g.get_stack_siz... | 5 | 29 | 32 |
921ce8aba294ccf5be0267cfbfe96eed56111986 | Xudong Huang | 2015-11-05T09:16:16 | add stack usage report interface | diff --git a/src/gen_impl.rs b/src/gen_impl.rs
index 0af150a..3811a21 100644
--- a/src/gen_impl.rs
+++ b/src/gen_impl.rs
@@ -118,8 +118,7 @@ impl<A: Any, T: Any, F> Drop for GeneratorImpl<A, T, F>
i += 1;
}
- let used_stack = self.context.stack.get_used_size();
- let total_stack = ... | 2 | 6 | 6 |
5d4c75eee6788a5c9d1d2f4d3f38a6a78dbcb0c9 | Xudong Huang | 2015-11-05T09:01:23 | add stack_size.rs | diff --git a/examples/stack_resize.rs b/examples/stack_resize.rs
new file mode 100644
index 0000000..2523c14
--- /dev/null
+++ b/examples/stack_resize.rs
@@ -0,0 +1,35 @@
+#[macro_use]
+extern crate generator;
+use generator::Gn;
+use generator::Generator;
+
+fn fib(a: u32, b: u32) -> u32 {
+ let (mut a, mut b) = (a... | 5 | 117 | 9 |
19f0324980a48402449fe1387acb764f55256f60 | Xudong Huang | 2015-11-05T00:26:23 | drop do nothing in panic | diff --git a/src/gen_impl.rs b/src/gen_impl.rs
index 9cc4846..f5b0059 100644
--- a/src/gen_impl.rs
+++ b/src/gen_impl.rs
@@ -46,10 +46,6 @@ impl<'a, A: Any, T: Any, F> GeneratorImpl<A, T, F>
let ptr = Box::into_raw(g);
let start: Box<FnBox()> = Box::new(move || {
- // here see... | 3 | 39 | 11 |
1735b7b38e2fddc2463c7acc71524dfb868f1376 | Xudong Huang | 2015-11-04T06:13:54 | move fn_gen to gen_impl | diff --git a/examples/send.rs b/examples/send.rs
index dcc4dc2..75418ef 100644
--- a/examples/send.rs
+++ b/examples/send.rs
@@ -1,6 +1,5 @@
#[macro_use]
extern crate generator;
-use generator::Generator;
fn sum(a: u32) -> u32 {
let mut sum = a;
diff --git a/src/fn_gen.rs b/src/gen_impl.rs
similarity index 94... | 4 | 12 | 14 |
e12ff7ffcdbd3969fc2e7fe9cbd56ab6aa8ddd3d | Xudong Huang | 2015-11-04T06:01:13 | add Gn helper | diff --git a/src/fn_gen.rs b/src/fn_gen.rs
index d6288e8..6f41c2c 100644
--- a/src/fn_gen.rs
+++ b/src/fn_gen.rs
@@ -14,9 +14,6 @@ use yield_::yield_now;
use rt::{Error, Context, ContextStack};
use reg_context::Context as RegContext;
-// default stack size is 1k * sizeof(usize)
-const DEFAULT_STACK_SIZE: usize = 10... | 5 | 60 | 53 |
e24402c8ed1691dc75e71d48561e7ae1f88095a1 | Xudong Huang | 2015-11-04T01:49:52 | use F as type para for FnGenerator | diff --git a/src/fn_gen.rs b/src/fn_gen.rs
index a996b89..d6288e8 100644
--- a/src/fn_gen.rs
+++ b/src/fn_gen.rs
@@ -18,25 +18,27 @@ use reg_context::Context as RegContext;
const DEFAULT_STACK_SIZE: usize = 1024;
/// FnGenerator
-pub struct FnGenerator<'a, A: Any, T: Any> {
+pub struct FnGenerator<A: Any, T: Any, F... | 3 | 37 | 33 |
7e82971a8c47460bd2efb974b96de064875d2517 | Xudong Huang | 2015-11-03T21:28:45 | add new_opt to specify init stack size | diff --git a/src/fn_gen.rs b/src/fn_gen.rs
index 6344a1c..a996b89 100644
--- a/src/fn_gen.rs
+++ b/src/fn_gen.rs
@@ -29,16 +29,38 @@ pub struct FnGenerator<'a, A: Any, T: Any> {
}
impl<'a, A: Any, T: Any> FnGenerator<'a, A, T> {
- /// create a new generator
+ /// create a new generator with default stack size... | 2 | 37 | 3 |
9d67755d96e020292866ee546af820f6feb6fa83 | Xudong Huang | 2015-11-03T21:02:29 | add stack size detection | diff --git a/src/fn_gen.rs b/src/fn_gen.rs
index 0d1adc4..6344a1c 100644
--- a/src/fn_gen.rs
+++ b/src/fn_gen.rs
@@ -14,6 +14,9 @@ use yield_::yield_now;
use rt::{Error, Context, ContextStack};
use reg_context::Context as RegContext;
+// default stack size is 1k * sizeof(usize)
+const DEFAULT_STACK_SIZE: usize = 10... | 4 | 43 | 8 |
0fb8cb962f165301b5fd35c51e84e994bcbd1220 | Xudong Huang | 2015-11-03T08:18:27 | add infinit loop drop support | diff --git a/src/fn_gen.rs b/src/fn_gen.rs
index 571acef..0d1adc4 100644
--- a/src/fn_gen.rs
+++ b/src/fn_gen.rs
@@ -91,8 +91,14 @@ impl<'a, A: Any, T: Any> FnGenerator<'a, A, T> {
impl<'a, A: Any, T: Any> Drop for FnGenerator<'a, A, T> {
fn drop(&mut self) {
+ let mut i = 0;
while !self.is_done... | 2 | 22 | 0 |
639de903b807a8e5be587037436ea566055740fd | Xudong Huang | 2015-11-06T06:29:31 | fix para type check | diff --git a/src/rt.rs b/src/rt.rs
index 562115b..c297c85 100644
--- a/src/rt.rs
+++ b/src/rt.rs
@@ -63,16 +63,15 @@ impl Context {
/// get current generator send para
#[inline]
- pub fn get_para<T>(&self) -> Option<T>
- where T: Any
+ pub fn get_para<A>(&self) -> Option<A>
+ where A: An... | 3 | 22 | 10 |
521606fc0866f054d6b6b29c6ef851aab08f98c4 | Xudong Huang | 2015-11-03T06:53:57 | support propagate panic inside generator to root context | diff --git a/src/fn_gen.rs b/src/fn_gen.rs
index 2e2fdc1..571acef 100644
--- a/src/fn_gen.rs
+++ b/src/fn_gen.rs
@@ -3,15 +3,15 @@
//! Rust generator implementation
//!
-use rt::Context;
-use rt::ContextStack;
-use yield_::{yield_now, Error};
-use Generator;
+use std::mem;
use std::thread;
-use std::boxed::FnBox... | 4 | 82 | 25 |
72978c2c8ca1f26e44edfc7ca7ab6737da95b1cd | Xudong Huang | 2015-11-05T02:36:25 | add get_yield example | diff --git a/examples/fib.rs b/examples/fib.rs
index 91b8d90..9545a1e 100644
--- a/examples/fib.rs
+++ b/examples/fib.rs
@@ -9,7 +9,7 @@ fn fib(a: u32, b: u32) -> u32 {
_yield_!(b);
}
- 10000
+ a + b
}
fn main() {
diff --git a/examples/get_yield.rs b/examples/get_yield.rs
new file mode 100644
... | 4 | 28 | 4 |
491de1a50604980e3bd07c72ce5b310af575e5be | Xudong Huang | 2015-11-02T19:15:30 | fix send logic | diff --git a/src/fn_gen.rs b/src/fn_gen.rs
index 358415e..2e2fdc1 100644
--- a/src/fn_gen.rs
+++ b/src/fn_gen.rs
@@ -98,16 +98,16 @@ impl<'a, A: Any, T: Any> Generator<A> for FnGenerator<'a, A, T> {
return None;
}
- // every time we call the function, increase the ref count
- // yi... | 3 | 32 | 6 |
e84f0f3c276c3b0eab600a2c383144b4e8996e33 | Xudong Huang | 2015-11-02T18:17:40 | implement yield_from | diff --git a/src/lib.rs b/src/lib.rs
index 08e3836..3784f6f 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -3,12 +3,13 @@
//! Rust generator library
//!
-#![feature(fnbox)]
#![feature(asm)]
#![feature(alloc)]
+#![feature(fnbox)]
#![feature(repr_simd)]
-#![feature(rustc_private)]
#![feature(catch_panic)]
+#![featur... | 3 | 72 | 19 |
990645e10839a905fe5c51fadf3dc9fabcefe162 | Xudong Huang | 2015-11-04T08:41:22 | fix yield bug | diff --git a/src/fn_gen.rs b/src/fn_gen.rs
index 3305acd..358415e 100644
--- a/src/fn_gen.rs
+++ b/src/fn_gen.rs
@@ -131,25 +131,28 @@ impl<'a, A: Any, T: Any> Generator<A> for FnGenerator<'a, A, T> {
fn gen_init(_: usize, f: *mut usize) -> ! {
let f = f as usize;
- let clo = move || {
- let func: Box... | 3 | 22 | 30 |
0821488764641ffd35d7141709dc3a0946c174e0 | Xudong Huang | 2015-11-04T08:29:53 | remove libc dependency | diff --git a/src/lib.rs b/src/lib.rs
index 5e233c4..08e3836 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -6,7 +6,6 @@
#![feature(fnbox)]
#![feature(asm)]
#![feature(alloc)]
-#![feature(libc)]
#![feature(repr_simd)]
#![feature(rustc_private)]
#![feature(catch_panic)]
@@ -15,7 +14,6 @@
#[macro_use]
extern crate ... | 1 | 0 | 2 |
f6e59ebaf467ff85af2fec8974ccecc3c0e8a61a | Xudong Huang | 2015-11-04T08:27:43 | remove context-rs dependency | diff --git a/Cargo.toml b/Cargo.toml
index a45d4c8..105d871 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -10,8 +10,6 @@ homepage = "https://github.com/Xudong-Huang/generator-rs.git"
keywords = ["generator", "coroutine", "green", "thread", "fiber"]
[dependencies]
-context = { git = "https://github.com/zonyitoo/contex... | 9 | 391 | 47 |
ca8a0a6bf27fa4e95993847484b286c76f757eef | Xudong Huang | 2015-10-24T22:49:39 | rustfmt all the code | diff --git a/examples/fib.rs b/examples/fib.rs
index 9afbbd8..91b8d90 100644
--- a/examples/fib.rs
+++ b/examples/fib.rs
@@ -1,5 +1,5 @@
-#[macro_use]
-extern crate generator;
+#[macro_use]
+extern crate g... | 6 | 40 | 36 |
0bdd99dc3c26ccee9a9d1b937c16d85bc318fdb0 | Xudong Huang | 2015-10-23T19:24:23 | adjust default stack size | diff --git a/src/fn_gen.rs b/src/fn_gen.rs
index 19f467f..033fbd7 100644
--- a/src/fn_gen.rs
+++ b/src/fn_gen.rs
@@ -33,7 +33,8 @@ impl<'a, A: Any, T: Any> FnGenerator<'a, A, T> {
{
let mut g = Box::new(FnGenerator {
para: None, ret: None, f: Some(Box::new(f)),
- context: Context::ne... | 4 | 7 | 8 |
dd22dcc583cdb02039fc7b1d6b7cd7d38ba16779 | Xudong Huang | 2015-10-23T16:37:28 | add yield context check | diff --git a/src/rt.rs b/src/rt.rs
index 593799f..ada6417 100644
--- a/src/rt.rs
+++ b/src/rt.rs
@@ -53,11 +53,17 @@ impl Context {
stack: unsafe { Stack::dummy_stack() },
para: unsafe { mem::transmute(&0 as &Any) },
ret: unsafe { mem::transmute(&0 as &Any) },
- _ref: 0... | 3 | 31 | 1 |
78e9e54d6a1a31067d655076e448ec043d7cf048 | Xudong Huang | 2015-10-23T15:25:16 | create yield module | diff --git a/src/fn_gen.rs b/src/fn_gen.rs
index 7fe7894..19f467f 100644
--- a/src/fn_gen.rs
+++ b/src/fn_gen.rs
@@ -5,7 +5,8 @@
use rt::Context;
use rt::ContextStack;
-use {Generator, yield_now, Error};
+use yield_::{yield_now, Error};
+use Generator;
use libc;
use std::thread;
diff --git a/src/generator.rs b/... | 4 | 141 | 125 |
97e8005cd18d5ef9d4235e0f873eb723a4754e33 | Xudong Huang | 2015-10-23T07:00:32 | add catch Error type | diff --git a/src/fn_gen.rs b/src/fn_gen.rs
index cce4e49..7fe7894 100644
--- a/src/fn_gen.rs
+++ b/src/fn_gen.rs
@@ -5,7 +5,7 @@
use rt::Context;
use rt::ContextStack;
-use {Generator, yield_now, Cancel, StackErr};
+use {Generator, yield_now, Error};
use libc;
use std::thread;
@@ -136,11 +136,12 @@ extern "C" f... | 2 | 14 | 9 |
42473b4a86b580f23c7f529e5a894a5d720e8799 | Xudong Huang | 2015-10-23T06:21:22 | refine cancel catch | diff --git a/src/fn_gen.rs b/src/fn_gen.rs
index 8ffebcd..cce4e49 100644
--- a/src/fn_gen.rs
+++ b/src/fn_gen.rs
@@ -5,7 +5,7 @@
use rt::Context;
use rt::ContextStack;
-use {Generator, yield_now};
+use {Generator, yield_now, Cancel, StackErr};
use libc;
use std::thread;
@@ -25,7 +25,6 @@ pub struct FnGenerator<... | 2 | 13 | 4 |
c3cf6beaee2d722e73b792f74756762f81fd57de | Xudong Huang | 2015-10-26T13:42:58 | implement cancel generator | diff --git a/src/fn_gen.rs b/src/fn_gen.rs
index 51abdb6..8ffebcd 100644
--- a/src/fn_gen.rs
+++ b/src/fn_gen.rs
@@ -108,6 +108,19 @@ impl<'a, A: Any, T: Any> Generator<A> for FnGenerator<'a, A, T> {
self.ret.take()
}
+ fn cancel(&mut self) {
+ // consume the fun if it's not started
+ i... | 3 | 58 | 14 |
b0e0c9e61ef70dca609c6311429b8af7813e8cb3 | Xudong Huang | 2015-10-22T19:50:32 | try to fix cargo test --release issue
but failed, normal release mode are ok | diff --git a/src/fn_gen.rs b/src/fn_gen.rs
index b625e63..51abdb6 100644
--- a/src/fn_gen.rs
+++ b/src/fn_gen.rs
@@ -42,11 +42,14 @@ impl<'a, A: Any, T: Any> FnGenerator<'a, A, T> {
unsafe {
let ptr = Box::into_raw(g);
- //let start = Box::new(||{g.ret = Some((g.f.take().unwrap())())}... | 1 | 7 | 4 |
4b403f1f140976c5e148cdb0a22cd8f488b4b2a3 | Xudong Huang | 2015-10-21T19:30:20 | refine catch_panic | diff --git a/src/fn_gen.rs b/src/fn_gen.rs
index 6f68abd..b625e63 100644
--- a/src/fn_gen.rs
+++ b/src/fn_gen.rs
@@ -43,20 +43,10 @@ impl<'a, A: Any, T: Any> FnGenerator<'a, A, T> {
let ptr = Box::into_raw(g);
//let start = Box::new(||{g.ret = Some((g.f.take().unwrap())())});
- le... | 1 | 13 | 17 |
6eabe8bb9ea9727fe80915102156e440c04202fd | Xudong Huang | 2015-10-21T19:03:29 | add catch panic | diff --git a/src/fn_gen.rs b/src/fn_gen.rs
index 4c659f1..6f68abd 100644
--- a/src/fn_gen.rs
+++ b/src/fn_gen.rs
@@ -5,10 +5,10 @@
use rt::Context;
use rt::ContextStack;
-use super::{Generator, yield_now};
+use {Generator, yield_now};
use libc;
-use std::rt::unwind::try;
+use std::thread;
use std::boxed::FnBox;... | 3 | 34 | 16 |
a23e73aee4ec8f76189518193e7aaff57768002d | Xudong Huang | 2015-10-19T14:05:35 | add test_inner_ref | diff --git a/tests/lib.rs b/tests/lib.rs
index 8f3e9d6..2860719 100644
--- a/tests/lib.rs
+++ b/tests/lib.rs
@@ -1,7 +1,7 @@
#[macro_use]
extern crate generator;
-use generator::{Generator, FnGenerator};
+use generator::*;
#[test]
fn generator_is_done() {
@@ -65,6 +65,37 @@ fn test_scoped_1() {
assert!(x =... | 1 | 32 | 1 |
0b251d813b203193f103d1825b995842c3e1502b | Xudong Huang | 2015-10-19T14:02:22 | put yield implementation within function
discard the return after load for compile time check
use run time check only for yield from sub level callee functions | diff --git a/src/lib.rs b/src/lib.rs
index cc07193..67336c0 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -16,13 +16,13 @@ extern crate libc;
extern crate context;
mod rt;
-pub use rt::Context;
-pub use rt::ContextStack;
+use rt::ContextStack;
mod fn_gen;
pub use fn_gen::FnGenerator;
use std::ptr;
+use std::an... | 1 | 31 | 20 |
74d314af39205fb21f5877cbd4be524c8545a157 | Xudong Huang | 2015-10-19T06:59:55 | add drop implmenation | diff --git a/src/fn_gen.rs b/src/fn_gen.rs
index d7d6807..4c659f1 100644
--- a/src/fn_gen.rs
+++ b/src/fn_gen.rs
@@ -78,6 +78,14 @@ impl<'a, A: Any, T: Any> FnGenerator<'a, A, T> {
}
+impl<'a, A: Any, T: Any> Drop for FnGenerator<'a, A, T> {
+ fn drop(&mut self){
+ while !self.is_done() {
+ se... | 2 | 23 | 0 |
cd76f4b50ee83ec0c09d340151fdd3c1c74b9438 | Xudong Huang | 2015-10-19T06:57:53 | support lifetime | diff --git a/src/fn_gen.rs b/src/fn_gen.rs
index cdff40e..d7d6807 100644
--- a/src/fn_gen.rs
+++ b/src/fn_gen.rs
@@ -15,21 +15,21 @@ use std::mem;
use context::Context as RegContext;
/// FnGenerator
-pub struct FnGenerator<A, T> {
+pub struct FnGenerator<'a, A: Any, T: Any> {
context: Context,
// save the... | 3 | 36 | 42 |
dea539916d2840d1ad345ebf8d09fb7db2f602bf | Xudong Huang | 2015-10-17T22:19:23 | rename generator.rs to fn_gen.rs | diff --git a/src/generator.rs b/src/fn_gen.rs
similarity index 100%
rename from src/generator.rs
rename to src/fn_gen.rs
diff --git a/src/lib.rs b/src/lib.rs
index 6f15a9a..bebee45 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -19,8 +19,8 @@ mod rt;
pub use rt::Context;
pub use rt::ContextStack;
-mod generator;
-pub ... | 2 | 2 | 2 |
aaf99bef58d7a8c52753ea7b1a008793cbe9ba44 | Xudong Huang | 2015-10-17T22:17:21 | Iterator for Generator Trait | diff --git a/src/generator.rs b/src/generator.rs
index 7975152..cdff40e 100644
--- a/src/generator.rs
+++ b/src/generator.rs
@@ -28,7 +28,7 @@ pub struct FnGenerator<A, T> {
impl<A: Any, T: Any> FnGenerator<A, T> {
/// create a new generator
- pub fn new<F>(f: F) -> Box<FnGenerator<A, T>>
+ pub fn new<F>(... | 2 | 24 | 22 |
90d0fd529822438e7ef9111900145fe7992ed641 | Xudong Huang | 2015-10-17T21:59:52 | move out generator definition | diff --git a/src/generator.rs b/src/generator.rs
new file mode 100644
index 0000000..7975152
--- /dev/null
+++ b/src/generator.rs
@@ -0,0 +1,137 @@
+//! # generator
+//!
+//! Rust generator implementation
+//!
+
+use rt::Context;
+use rt::ContextStack;
+use super::{Generator, yield_now};
+
+use libc;
+use std::rt::unwi... | 2 | 140 | 125 |
adeab25f4d55ba6447f1528bcc570250beab9cca | Xudong Huang | 2015-10-17T21:42:24 | move context to rt.rs | diff --git a/src/lib.rs b/src/lib.rs
index 65de3d8..497cd78 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -16,89 +16,15 @@ extern crate libc;
extern crate context;
mod rt;
+pub use rt::Context;
pub use rt::ContextStack;
-use context::Stack;
-use context::Context as RegContext;
use std::rt::unwind::try;
-use std::... | 2 | 80 | 77 |
dc798463c1f2cb5293ba0c5c0df4d494b6a98f64 | Xudong Huang | 2015-10-17T21:25:17 | rename env.rs to rt.rs | diff --git a/src/lib.rs b/src/lib.rs
index a3071ac..65de3d8 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -15,8 +15,8 @@ extern crate log;
extern crate libc;
extern crate context;
-pub mod env;
-pub use env::ContextStack;
+mod rt;
+pub use rt::ContextStack;
use context::Stack;
use context::Context as RegContext;
... | 2 | 4 | 4 |
a2470a7468d4cad2876636fc2c4fcfde486589c3 | Xudong Huang | 2015-10-17T21:21:46 | move make_gen to FnGenerator::new | diff --git a/src/lib.rs b/src/lib.rs
index 86f90c7..a3071ac 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -124,7 +124,39 @@ pub struct FnGenerator<A, T> {
}
-impl<A, T> FnGenerator<A, T> {
+impl<A: Any, T: Any> FnGenerator<A, T> {
+ /// create a new generator
+ pub fn new<F>(f: F) -> Box<FnGenerator<A, T>>
+ ... | 2 | 37 | 36 |
17eb58fe8a849d724a07e9024416fa2ae1207a7a | Xudong Huang | 2015-10-17T20:14:04 | make_gen can accept FnOnce type | diff --git a/src/lib.rs b/src/lib.rs
index 5f37846..86f90c7 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -215,9 +215,11 @@ extern "C" fn gen_init(arg: usize, f: *mut libc::c_void) -> ! {
}
/// create generator
-pub fn make_gen<A: Any, T: Any>(f: Box<FnBox()->T>) -> Box<FnGenerator<A, T>> {
+pub fn make_gen<A: Any, T... | 2 | 7 | 5 |
5b8c00fbc787304339fccebde30ba6221715ad52 | Xudong Huang | 2015-10-17T19:41:33 | para default init to None | diff --git a/src/lib.rs b/src/lib.rs
index f38a992..5f37846 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -215,9 +215,9 @@ extern "C" fn gen_init(arg: usize, f: *mut libc::c_void) -> ! {
}
/// create generator
-pub fn make_gen<A: Any, T: Any>(p: Option<A>, f: Box<FnBox()->T>) -> Box<FnGenerator<A, T>> {
+pub fn make_... | 2 | 5 | 12 |
c04d0810fce331af405490337c81e95d5581fe53 | Xudong Huang | 2015-10-08T02:49:35 | update according to context | diff --git a/src/lib.rs b/src/lib.rs
index b2fbe2f..f38a992 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -198,16 +198,20 @@ pub fn yield_now() {
}
#[allow(unused_variables)]
-extern "C" fn gen_init(arg: usize, f: *mut libc::c_void) {
- let func: Box<Box<FnBox()>> = unsafe {
- Box::from_raw(f as *mut Box<Fn... | 2 | 42 | 30 |
4215eeb7605431597124ffedf26046c974dc80a8 | Xudong Huang | 2015-10-11T05:57:49 | mark yield as safe code | diff --git a/examples/fib.rs b/examples/fib.rs
index 6427de0..9afbbd8 100644
--- a/examples/fib.rs
+++ b/examples/fib.rs
@@ -1,7 +1,7 @@
#[macro_use]
extern crate generator;
-unsafe fn fib(a: u32, b: u... | 4 | 9 | 9 |
6f6a6f608ddacf85aa207c588feaaec576f23e85 | Xudong Huang | 2015-10-05T19:43:11 | add test | diff --git a/tests/lib.rs b/tests/lib.rs
new file mode 100644
index 0000000..438abce
--- /dev/null
+++ b/tests/lib.rs
@@ -0,0 +1,65 @@
+#[macro_use]
+extern crate generator;
+
+use generator::Generator;
+
+unsafe fn f0() {
+ let mut i = 0;
+ println!("{}", i);
+
+ _yield_!();
+
+ i = 100;
+ println!("{}"... | 1 | 65 | 0 |
d38515d14604c04258d1026bfcdf740114fd52d7 | Xudong Huang | 2015-10-07T12:45:07 | remove binary build | diff --git a/Cargo.toml b/Cargo.toml
index 42a390f..a45d4c8 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -17,6 +17,3 @@ libc = "*"
name = "generator"
path = "src/lib.rs"
-[[bin]]
-name = "generator"
-path = "src/main.rs"
diff --git a/src/main.rs b/src/main.rs
deleted file mode 100644
index f1b114f..0000000
--- a/src... | 2 | 0 | 67 |
c9f42fff03d3a3211a3e9a90104483e89eb699be | Xudong Huang | 2015-08-28T00:57:35 | mark yield as unsafe | diff --git a/src/lib.rs b/src/lib.rs
index af08242..3c2029a 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -185,7 +185,7 @@ impl<A: Any, T: Any> Iterator for FnGenerator<A, T> {
}
/// switch back to parent context
-pub fn yield_now() {
+pub unsafe fn yield_now() {
let env = ContextStack::current();
let ctx =... | 1 | 2 | 2 |
be1cb5f8321be762e232e74fcd54e3a9853b4356 | Xudong Huang | 2015-08-28T00:14:19 | use option take | diff --git a/src/lib.rs b/src/lib.rs
index a1de1a4..af08242 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -87,8 +87,7 @@ impl Context {
pub fn get_para<T>(&self) -> Option<T> where T: Any {
let para = unsafe { &mut *self.para };
let val = para.downcast_mut::<Option<T>>().unwrap();
- // simpl... | 1 | 1 | 2 |
b7e66f473fef3d8f3b489092327053a190c6e37a | Xudong Huang | 2015-08-28T00:07:28 | reduce _yield macro | diff --git a/src/lib.rs b/src/lib.rs
index d8b4781..a1de1a4 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -265,23 +265,10 @@ macro_rules! _yield {
// `(para)`
// val: the value that need to be yield
// and got the send para from context
- ($val:expr) => (
- {
- let context = generator... | 1 | 16 | 31 |
ecd1b6a2d2bc9ed5c740e4fd155bab13312d7c65 | Xudong Huang | 2015-09-04T07:29:54 | refine send interface | diff --git a/examples/send.rs b/examples/send.rs
new file mode 100644
index 0000000..91ab7cf
--- /dev/null
+++ b/examples/send.rs
@@ -0,0 +1,24 @@
+#[macro_use]
+extern crate generator;
+use generator::Generator;
+
+unsafe fn sum(a: u32) -> u32 {
+ let m... | 3 | 40 | 12 |
68cad60c0dabad6c7f2161223c74b84c1f3cb78d | Xudong Huang | 2015-08-27T21:22:49 | add fib example | diff --git a/examples/fib.rs b/examples/fib.rs
new file mode 100644
index 0000000..7053dc0
--- /dev/null
+++ b/examples/fib.rs
@@ -0,0 +1,22 @@
+#[macro_use]
+extern crate generator;
+
+unsafe fn fib(a: u3... | 2 | 22 | 2 |
053e6eda97424d5056c68d9ac43120f948414627 | Xudong Huang | 2015-08-27T18:11:50 | use rt min_stack | diff --git a/src/lib.rs b/src/lib.rs
index 9805a27..0618217 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -21,6 +21,7 @@ pub use env::ContextStack;
use context::Stack;
use context::Context as RegContext;
use std::rt::unwind::try;
+use std::rt::util::min_stack;
use std::boxed::FnBox;
use std::any::Any;
use std::mem;... | 1 | 2 | 3 |
a831bc1a1a52b2dc3e080f780419030738ee2257 | Janosch Gräf | 2024-06-28T10:11:28 | generate-catalog: add -h/--help flag | diff --git a/generate-catalog/src/main.rs b/generate-catalog/src/main.rs
index 7572212..112e82d 100644
--- a/generate-catalog/src/main.rs
+++ b/generate-catalog/src/main.rs
@@ -1,4 +1,4 @@
-use std::{fs::File, io::{BufWriter, Write}, path::PathBuf, str::FromStr};
+use std::{borrow::Cow, fs::File, io::{BufWriter, Write}... | 1 | 11 | 5 |
619a5b919cbc07dd2b0fa9b2295a2eaaeddde2cd | Akhil Velagapudi | 2023-11-04T19:08:54 | Forbid unsafe code
Signed-off-by: Akhil Velagapudi <4@4khil.com> | diff --git a/src/lib.rs b/src/lib.rs
index 868d88f..1b5961e 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,4 +1,5 @@
#![no_std]
+#![forbid(unsafe_code)]
#[rustfmt::skip]
pub mod algorithm; | 1 | 1 | 0 |
b500ea693c552f8d946e290722a7b3ee8b9a7ee2 | Akhil Velagapudi | 2023-11-04T18:43:37 | Prepare 2.4.0 release | diff --git a/Cargo.toml b/Cargo.toml
index 3fed42d..f0083ab 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "crc-catalog"
-version = "2.3.0"
+version = "2.4.0"
authors = ["Akhil Velagapudi <akhilvelagapudi@gmail.com>"]
edition = "2018"
description = "Catalog of CRC algorithms (generated f... | 1 | 1 | 1 |
07c3e0f38d4cdfd9f5075f370c6f1b4648339aa7 | Akhil Velagapudi | 2023-11-01T05:19:06 | Prepare 2.3.0 release | diff --git a/Cargo.toml b/Cargo.toml
index 1cc97d1..3fed42d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "crc-catalog"
-version = "2.2.0"
+version = "2.3.0"
authors = ["Akhil Velagapudi <akhilvelagapudi@gmail.com>"]
edition = "2018"
description = "Catalog of CRC algorithms (generated f... | 1 | 1 | 1 |
4219ef0ab0d299a113c1887285387d6609dade93 | Akhil Velagapudi | 2023-01-15T21:00:45 | Add polynomial constants
CRC algorithms are commonly referred to by the name of the polynomial
they use. Add a submodule that contains polynomial constants and their
names/aliases in order to help find an appropriate algorithm.
Signed-off-by: Akhil Velagapudi <4@4khil.com> | diff --git a/src/lib.rs b/src/lib.rs
index 767a2df..2898f43 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -2,6 +2,7 @@
#[rustfmt::skip]
mod catalog;
+pub mod poly;
pub use catalog::*;
pub trait Width: Sized + 'static {}
diff --git a/src/poly.rs b/src/poly.rs
new file mode 100644
index 0000000..c8e25ee
--- /dev/nu... | 2 | 14 | 0 |
d18d9fb4f613f58724111403b39ae7a1f6bc9c3e | Akhil Velagapudi | 2023-01-11T03:15:47 | Prepare 2.2.0 release | diff --git a/Cargo.toml b/Cargo.toml
index b00e954..1cc97d1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "crc-catalog"
-version = "2.1.0"
+version = "2.2.0"
authors = ["Akhil Velagapudi <akhilvelagapudi@gmail.com>"]
edition = "2018"
description = "Catalog of CRC algorithms (generated f... | 1 | 1 | 1 |
a43a0924eec0c4080b81853d03c348b2edf0c60f | Akhil Velagapudi | 2023-01-11T03:13:11 | Add M17, REDIS algorithms | diff --git a/src/catalog.rs b/src/catalog.rs
index 201df09..779d0a5 100644
--- a/src/catalog.rs
+++ b/src/catalog.rs
@@ -63,6 +63,7 @@ pub const CRC_16_IBM_SDLC: Algorithm<u16> = Algorithm { width: 16, poly: 0x1021,
pub const CRC_16_ISO_IEC_14443_3_A: Algorithm<u16> = Algorithm { width: 16, poly: 0x1021, init: 0xc6c6,... | 1 | 2 | 0 |
1f5ae6c95666d0b082b4e2d8dc3c51b1a7b6f17e | Akhil Velagapudi | 2022-04-23T02:24:36 | Prepare 2.1.0 release | diff --git a/Cargo.toml b/Cargo.toml
index f8fa311..b00e954 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "crc-catalog"
-version = "2.0.1"
+version = "2.1.0"
authors = ["Akhil Velagapudi <akhilvelagapudi@gmail.com>"]
edition = "2018"
description = "Catalog of CRC algorithms (generated f... | 1 | 1 | 1 |
a22db8d325ef7029baddf922dc06306b857cbc7c | Akhil Velagapudi | 2022-04-23T02:23:30 | Add HITAG, MEF, MS algorithms | diff --git a/src/catalog.rs b/src/catalog.rs
index 234ca21..201df09 100644
--- a/src/catalog.rs
+++ b/src/catalog.rs
@@ -21,6 +21,7 @@ pub const CRC_8_DARC: Algorithm<u8> = Algorithm { width: 8, poly: 0x39, init: 0x
pub const CRC_8_DVB_S2: Algorithm<u8> = Algorithm { width: 8, poly: 0xd5, init: 0x00, refin: false, ref... | 1 | 3 | 0 |
7cbf5e92d579e8e83be5b3473ea67dad5bb66c89 | Akhil Velagapudi | 2021-10-23T01:57:36 | Prepare for 2.0.0 release | diff --git a/Cargo.toml b/Cargo.toml
index 662e21a..9aabf8a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,8 +1,8 @@
[package]
name = "crc-catalog"
-version = "1.1.1"
+version = "2.0.0"
authors = ["Akhil Velagapudi <akhilvelagapudi@gmail.com>"]
-edition = "2018"
+edition = "2021"
description = "Catalog of CRC algor... | 1 | 4 | 2 |
ab830385b6453f18d1ae0746afd84f1bd133a221 | Akhil Velagapudi | 2021-02-09T17:46:00 | Prepare for 1.1.1 release | diff --git a/Cargo.toml b/Cargo.toml
index 6a687f8..662e21a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "crc-catalog"
-version = "1.1.0"
+version = "1.1.1"
authors = ["Akhil Velagapudi <akhilvelagapudi@gmail.com>"]
edition = "2018"
description = "Catalog of CRC algorithms (generated f... | 1 | 1 | 1 |
f4015e818368dc2bd5840b688b5d3b171d3662fa | Xiretza | 2021-02-09T17:29:43 | Add rustdoc comments to Register struct | diff --git a/src/lib.rs b/src/lib.rs
index 5d093c7..25edc05 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -9,12 +9,44 @@ impl Width for u16 {}
impl Width for u32 {}
impl Width for u64 {}
+/// This struct describes a CRC algorithm using the fields specified by the [Catalogue of
+/// parametrised CRC algorithms](https:... | 1 | 32 | 0 |
aa4a7cf033fc4f1f9bd179f2e425599cd32fa864 | Akhil Velagapudi | 2020-08-08T23:06:15 | add 'static and Sized to Width | diff --git a/Cargo.toml b/Cargo.toml
index 1696979..6a687f8 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "crc-catalog"
-version = "1.0.0"
+version = "1.1.0"
authors = ["Akhil Velagapudi <akhilvelagapudi@gmail.com>"]
edition = "2018"
description = "Catalog of CRC algorithms (generated f... | 2 | 2 | 2 |
2b19dcf28197319bf0d727279d9bda5149906113 | Akhil Velagapudi | 2020-03-17T19:07:36 | only build docs for x86_64-unknown-linux-gnu | diff --git a/Cargo.toml b/Cargo.toml
index dc08fa1..1696979 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "crc-catalog"
-version = "0.1.0"
+version = "1.0.0"
authors = ["Akhil Velagapudi <akhilvelagapudi@gmail.com>"]
edition = "2018"
description = "Catalog of CRC algorithms (generated f... | 1 | 4 | 1 |
7712c7cb4d72e52b6896ba56990ed1095a317de5 | Adam Wick | 2026-02-12T17:07:16 | Fix a typo, make the repo slippy-clean, and bump the revision. (#39)
Pretty much what it says in the title. | diff --git a/Cargo.toml b/Cargo.toml
index 6ed49ad..364ef14 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
-e[package]
+[package]
name = "simple_asn1"
-version = "0.6.3"
+version = "0.6.4"
authors = ["Adam Wick <awick@uhsure.com>"]
description = "A simple DER/ASN.1 encoding/decoding library."
categories =... | 2 | 22 | 24 |
b40a5dcd970c8b15d20998bde7bf8fcf2be8e502 | Dylan DPC | 2026-02-12T06:25:06 | Update Cargo.toml | diff --git a/Cargo.toml b/Cargo.toml
index c71a25b..6ed49ad 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,4 +1,4 @@
-[package]
+e[package]
name = "simple_asn1"
version = "0.6.3"
authors = ["Adam Wick <awick@uhsure.com>"]
@@ -13,7 +13,7 @@ edition = "2018"
num-bigint = { default-features = false, version = "0.4" }
... | 1 | 2 | 2 |
6043fc6d6a798b9c28dbe0e2f902fa00953b51a8 | Adam Wick | 2025-01-12T21:41:37 | Clean up some new warnings re parentheses. | diff --git a/src/lib.rs b/src/lib.rs
index 3d990d3..80afd71 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -152,34 +152,34 @@ impl ASN1Block {
impl PartialEq for ASN1Block {
fn eq(&self, other: &ASN1Block) -> bool {
match (self, other) {
- (&ASN1Block::Boolean(_, a1), &ASN1Block::Boolean(_, a2)) ... | 1 | 9 | 9 |
d7b31d67d37188395c5d63eb6a0490d30afd5f72 | Сахаров Андрей Александрович | 2025-01-11T13:53:28 | bump a thiserror version | diff --git a/Cargo.toml b/Cargo.toml
index c77dc1b..c71a25b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "simple_asn1"
-version = "0.6.2"
+version = "0.6.3"
authors = ["Adam Wick <awick@uhsure.com>"]
description = "A simple DER/ASN.1 encoding/decoding library."
categories = ["encoding"... | 1 | 2 | 2 |
74719369dd3687388fed6ca7d08e38d3666fe448 | Adam Wick | 2022-06-03T15:25:50 | Bump version to 0.6.2. | diff --git a/Cargo.toml b/Cargo.toml
index def4eeb..c77dc1b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "simple_asn1"
-version = "0.6.1"
+version = "0.6.2"
authors = ["Adam Wick <awick@uhsure.com>"]
description = "A simple DER/ASN.1 encoding/decoding library."
categories = ["encoding"... | 1 | 1 | 1 |
6cca5625980e61669a5588af55be42b3fa8104bf | Chris Connelly | 2022-03-13T20:09:14 | Set `time/quickcheck` feature only in dev
This prevents `quickcheck` appearing in the regular build dependencies. | diff --git a/Cargo.toml b/Cargo.toml
index e1e07a1..def4eeb 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,8 +13,9 @@ edition = "2018"
num-bigint = { default-features = false, version = "0.4" }
num-traits = { default-features = false, version = "0.2" }
thiserror = { default-features = false, version = "1" }
-time ... | 1 | 2 | 1 |
430d907c4219696009279eb2aae212b28f95d5ad | Klim Tsoutsman | 2022-01-03T11:06:08 | Use `vec!` in `oid!` macro
Signed-off-by: Klim Tsoutsman <klimusha@gmail.com> | diff --git a/src/lib.rs b/src/lib.rs
index 6ae9a73..3d990d3 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -282,12 +282,7 @@ impl<'a> PartialEq<OID> for &'a OID {
#[macro_export]
macro_rules! oid {
( $( $e: expr ),* ) => {{
- let mut res = Vec::new();
-
- $(
- res.push($crate::BigUint::from... | 1 | 1 | 6 |
b0277bb0addfee74e75725196dd0490e164ca9e1 | Adam Wick | 2021-11-14T21:51:47 | Bump version number to cover security and clippy/fmt patches. | diff --git a/Cargo.toml b/Cargo.toml
index c908d88..e1e07a1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "simple_asn1"
-version = "0.6.0"
+version = "0.6.1"
authors = ["Adam Wick <awick@uhsure.com>"]
description = "A simple DER/ASN.1 encoding/decoding library."
categories = ["encoding"... | 1 | 1 | 1 |
4df1173ecb7339e9bd5f98aa5e71704f86a7597b | Adam Wick | 2021-11-14T21:50:25 | Fix formatting to `rustfmt` standards. | diff --git a/src/lib.rs b/src/lib.rs
index 547a140..6ae9a73 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1444,7 +1444,9 @@ mod tests {
fn utc_time_tests() {
// Check for a regression against issue #27, in which this would
// cause a panic.
- let input = [55, 13, 13, 133, 13, 13, 50, 13, 13... | 1 | 3 | 1 |
9ab60920d2cf909c076951839126f21031e4ab7c | Nick Mathewson | 2021-11-14T15:18:35 | Fix all clippy warnings in the current code under Rust 1.56. | diff --git a/src/lib.rs b/src/lib.rs
index af2c3dc..33a8153 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -102,50 +102,49 @@ impl ASN1Block {
/// Get the class associated with the given ASN1Block, regardless of what
/// kind of block it is.
pub fn class(&self) -> ASN1Class {
- match self {
- ... | 1 | 81 | 85 |
c98100429071a2dca3191c0d0dfa17cd64fcdda2 | Nick Mathewson | 2021-11-14T14:39:59 | Fix a panic from an unchecked string slice.
When slicing a string, you get a panic if you do so at any point
other than at a character boundary. This happened in the
implementation of UTCTime parsing.
This bug was introduced in bc156c36d76d91b77cdf8f1f231e2c554ea0e454,
and appears to affect only version 0.6.0.
I've... | diff --git a/src/lib.rs b/src/lib.rs
index af2c3dc..a7e7495 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -505,7 +505,13 @@ fn from_der_(i: &[u8], start_offset: usize) -> Result<Vec<ASN1Block>, ASN1Decode
let v = String::from_iter(body.iter().map(|x| *x as char));
- let y = &v[0..2];
+... | 1 | 16 | 1 |
bc156c36d76d91b77cdf8f1f231e2c554ea0e454 | Adam Wick | 2021-10-20T17:08:05 | Bump version number to reflect API change. | diff --git a/Cargo.toml b/Cargo.toml
index 0bb2ebb..c908d88 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "simple_asn1"
-version = "0.5.4"
+version = "0.6.0"
authors = ["Adam Wick <awick@uhsure.com>"]
description = "A simple DER/ASN.1 encoding/decoding library."
categories = ["encoding"... | 1 | 1 | 1 |
34c0267144029c85fbdda2f5dc449e151f5423dd | Adam-Gleave | 2021-10-20T16:51:30 | Remove comment | diff --git a/src/lib.rs b/src/lib.rs
index 6857ad3..af2c3dc 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -26,7 +26,6 @@
//!
//! Please send any bug reports, patches, and curses to the GitHub repository
//! at <code>https://github.com/acw/simple_asn1</code>.
-// use chrono::{DateTime, TimeZone, Utc};
pub use num_bigi... | 1 | 0 | 1 |
d7d39d709577710e9dc8833ee57d200eef366db8 | Adam-Gleave | 2021-10-20T16:30:37 | Remove chrono dependency in favour of time crate | diff --git a/Cargo.toml b/Cargo.toml
index 4cb8c4e..0bb2ebb 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -10,10 +10,10 @@ repository = "https://github.com/acw/simple_asn1"
edition = "2018"
[dependencies]
-chrono = { default-features = false, features = ["alloc"], version = "0.4" }
num-bigint = { default-feature... | 2 | 95 | 55 |
77a9c2b48fc71bf7d54adff8954b11dc47e6b182 | Adam Wick | 2021-06-25T02:34:14 | Bump rand version to 0.8.4, and crate version to 0.5.4. | diff --git a/Cargo.toml b/Cargo.toml
index 6e24371..4cb8c4e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "simple_asn1"
-version = "0.5.3"
+version = "0.5.4"
authors = ["Adam Wick <awick@uhsure.com>"]
description = "A simple DER/ASN.1 encoding/decoding library."
categories = ["encoding"... | 1 | 2 | 2 |
fcba9cb4beaa00a1a4e632025df081f5a7785a3a | Jack Lloyd | 2021-06-22T16:14:39 | Add $crate:: metavariable to the oid! macro
This allows using the oid macro without having to import BigUint | diff --git a/src/lib.rs b/src/lib.rs
index 1c56e09..6f7d278 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -286,9 +286,9 @@ macro_rules! oid {
let mut res = Vec::new();
$(
- res.push(BigUint::from($e as u64));
+ res.push($crate::BigUint::from($e as u64));
)*
- OID:... | 1 | 2 | 2 |
3bc5c14a193d645659f7be33a7fe2d96035587a0 | Jack Lloyd | 2021-06-03T20:56:40 | impl Eq for OID
Closes #23 | diff --git a/src/lib.rs b/src/lib.rs
index 895ce8a..1c56e09 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -195,7 +195,7 @@ impl PartialEq for ASN1Block {
}
/// An ASN.1 OID.
-#[derive(Clone, Debug, PartialEq)]
+#[derive(Clone, Debug, PartialEq, Eq)]
pub struct OID(Vec<BigUint>);
impl OID { | 1 | 1 | 1 |
35cdea3dbe25e44b8acce00765027e62185f7618 | Adam Wick | 2021-05-18T15:06:33 | Bump version to 0.5.3 | diff --git a/Cargo.toml b/Cargo.toml
index 4dc7235..6e24371 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "simple_asn1"
-version = "0.5.2"
+version = "0.5.3"
authors = ["Adam Wick <awick@uhsure.com>"]
description = "A simple DER/ASN.1 encoding/decoding library."
categories = ["encoding"... | 1 | 1 | 1 |
2d2d9a3bbb1ee9b3be5b6c19674988bb84b7eb48 | Oleksandr Kravchenko | 2021-05-17T16:48:18 | Implement as_vec for OID
Change-Id: I29d59b77b541454007343488f8f809c3052ad3e3 | diff --git a/src/lib.rs b/src/lib.rs
index c1bd391..895ce8a 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -31,6 +31,7 @@ pub use num_bigint::{BigInt, BigUint};
use num_traits::{FromPrimitive, One, ToPrimitive, Zero};
#[cfg(test)]
use quickcheck::quickcheck;
+use std::convert::TryFrom;
use std::iter::FromIterator;
us... | 1 | 35 | 0 |
19a466bb073bfaaf3e9bdc593eeef8cabffd6ce3 | Adam Wick | 2021-04-18T20:20:33 | Bump the version to 0.5.2. | diff --git a/Cargo.toml b/Cargo.toml
index 6ea93f0..4dc7235 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "simple_asn1"
-version = "0.5.1"
+version = "0.5.2"
authors = ["Adam Wick <awick@uhsure.com>"]
description = "A simple DER/ASN.1 encoding/decoding library."
categories = ["encoding"... | 1 | 1 | 1 |
c585acc5306cdabdabe3041128caa8f76cdad5e5 | Adam Wick | 2021-04-18T20:17:01 | Upgrade the QuickCheck/rand dependencies.
This also adds a check in the synthesis of arbitary items of unknown type,
to ensure that we don't accidentally create objects with a known type. I'm
actually not 100% sure how the old tests were passing so reliably, which
is worrying. | diff --git a/Cargo.toml b/Cargo.toml
index acfb072..6ea93f0 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -16,5 +16,5 @@ num-traits = { default-features = false, version = "0.2" }
thiserror = { default-features = false, version = "1" }
[dev-dependencies]
-quickcheck = "0.9"
-rand = "0.7"
+quickcheck = "1.0.3"
+rand ... | 2 | 92 | 65 |
8305ec24d7113158115d55b72887cd1f4154bddd | Stanislav Tkach | 2021-04-14T12:17:23 | Update the `num-bigint` crate version | diff --git a/Cargo.toml b/Cargo.toml
index 05ae456..acfb072 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,7 +11,7 @@ edition = "2018"
[dependencies]
chrono = { default-features = false, features = ["alloc"], version = "0.4" }
-num-bigint = { default-features = false, version = "0.3" }
+num-bigint = { default-... | 1 | 1 | 1 |
1903cb6ab5ab1819d6b32e26b0d0a017fcda5e07 | Seinlin Li | 2021-02-25T09:33:17 | Add the missing N character. | diff --git a/src/lib.rs b/src/lib.rs
index b0e4ff5..c5ebe1a 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -279,7 +279,7 @@ macro_rules! oid {
}
const PRINTABLE_CHARS: &'static str =
- "ABCDEFGHIJKLMOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'()+,-./:=? ";
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuv... | 1 | 1 | 1 |
90d24b6d89e0df51216f5fdbaaab712c53a0869a | Adam Wick | 2021-01-08T17:20:05 | Version number bump (0.5.0 --> 0.5.1) | diff --git a/Cargo.toml b/Cargo.toml
index 0c4d7e8..05ae456 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "simple_asn1"
-version = "0.5.0"
+version = "0.5.1"
authors = ["Adam Wick <awick@uhsure.com>"]
description = "A simple DER/ASN.1 encoding/decoding library."
categories = ["encoding"... | 1 | 1 | 1 |
559db125d369e68d20d026c9458d8f5f5378dbb2 | Robert Bragg | 2021-01-08T13:43:07 | Use thiserror macro to derive Error + Display traits
This removes the manual implementation of Display + Error for
ASN1EncodeErr and uses the derive macro from `thiserror` to add
std Error and Display implementations for ANS1EncodeErr and
ASN1DecodeErr. | diff --git a/Cargo.toml b/Cargo.toml
index 6241b8c..0c4d7e8 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,6 +13,7 @@ edition = "2018"
chrono = { default-features = false, features = ["alloc"], version = "0.4" }
num-bigint = { default-features = false, version = "0.3" }
num-traits = { default-features = false, ... | 2 | 16 | 68 |
7db7a487f498858ef330310dfa458b8f0713e4e7 | Caio | 2020-10-18T01:59:31 | Update dependencies | diff --git a/Cargo.toml b/Cargo.toml
index 1d0db22..63e8ce5 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -9,10 +9,10 @@ license = "ISC"
repository = "https://github.com/acw/simple_asn1"
[dependencies]
-chrono = "^0.4.0"
-num-bigint = "^0.2.0"
-num-traits = "^0.2.0"
+chrono = { default-features = false, featu... | 2 | 40 | 34 |
7b6e48d8fb7acf6bd612e9672e3619d00972c785 | Adam Wick | 2020-07-15T15:20:25 | Bump minor version, to address license change. | diff --git a/Cargo.toml b/Cargo.toml
index b5ed60f..1d0db22 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "simple_asn1"
-version = "0.4.0"
+version = "0.4.1"
authors = ["Adam Wick <awick@uhsure.com>"]
description = "A simple DER/ASN.1 encoding/decoding library."
categories = ["encoding"... | 1 | 1 | 1 |
d4ac17598acdf437a256a3a469ab4ca85597cf84 | Marco Neumann | 2020-07-13T13:21:02 | use a machine-readable license key
See https://doc.rust-lang.org/cargo/reference/manifest.html#the-license-and-license-file-fields :
> If a package is using a nonstandard license, then the license-file field may be specified in lieu of the license
> field.
`simple_asn1` however uses a standard license (ISC, as per L... | diff --git a/Cargo.toml b/Cargo.toml
index a419fe6..b5ed60f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -5,7 +5,7 @@ authors = ["Adam Wick <awick@uhsure.com>"]
description = "A simple DER/ASN.1 encoding/decoding library."
categories = ["encoding"]
keywords = ["ASN1","encoding","DER"]
-license-file = "LICENSE"
+licen... | 1 | 1 | 1 |
5d07dc7cc3df200b5b2691c9490985128247f755 | Adam Wick | 2020-06-15T00:01:24 | Remove some post-fmt warnings. | diff --git a/src/lib.rs b/src/lib.rs
index 8d71ebe..1878d2d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -160,22 +160,22 @@ impl PartialEq for ASN1Block {
(&ASN1Block::OctetString(_, ref a1), &ASN1Block::OctetString(_, ref a2)) => (a1 == a2),
(&ASN1Block::Null(_), &ASN1Block::Null(_)) => true,
... | 1 | 5 | 5 |
5bb01ae0e4861cf8c9d88c9e4fc4a9399722d5af | Adam Wick | 2020-06-14T23:38:23 | Make this subject to rustfmt. | diff --git a/src/lib.rs b/src/lib.rs
index 05d53e2..8d71ebe 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -102,24 +102,24 @@ impl ASN1Block {
/// kind of block it is.
pub fn class(&self) -> ASN1Class {
match self {
- &ASN1Block::Boolean(_,_) => ASN1Class::Universal,
- &AS... | 1 | 168 | 209 |
ce2bf1407c2705cce2a6f976e9ae66e614d3485f | Adam Wick | 2020-06-14T23:37:43 | Start bringing this library into a more modern idiom. | diff --git a/Cargo.toml b/Cargo.toml
index a419fe6..35ddab0 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,12 +1,13 @@
[package]
name = "simple_asn1"
-version = "0.4.0"
+version = "0.5.0"
authors = ["Adam Wick <awick@uhsure.com>"]
description = "A simple DER/ASN.1 encoding/decoding library."
categories = ["encodin... | 2 | 7 | 68 |
47a5140bf29abf33e143bc6d53322eeb4979d686 | Bernhard Schuster | 2019-12-13T20:25:44 | feat(as_raw) impl as_raw for OID | diff --git a/src/lib.rs b/src/lib.rs
index 54870f0..ca5fb9c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -230,6 +230,44 @@ impl OID {
pub fn new(x: Vec<BigUint>) -> OID {
OID(x)
}
+
+ /// converts the
+ pub fn as_raw(&self) -> Result<Vec<u8>, ASN1EncodeErr> {
+ match (self.0.get(0), self.... | 1 | 111 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.