File tree Expand file tree Collapse file tree 5 files changed +40
-5
lines changed Expand file tree Collapse file tree 5 files changed +40
-5
lines changed Original file line number Diff line number Diff line change @@ -9,11 +9,15 @@ repository = "https://github.com/mlafeldt/codebreaker-rs"
9
9
documentation = " https://docs.rs/codebreaker/"
10
10
homepage = " https://crates.io/crates/codebreaker"
11
11
keywords = [" codebreaker" , " ps2" , " gamehacking" , " homebrew" ]
12
- categories = [" algorithms" , " cryptography" ]
12
+ categories = [" algorithms" , " cryptography" , " no-std " ]
13
13
edition = " 2018"
14
14
15
15
[lib ]
16
16
name = " codebreaker"
17
17
18
18
[dependencies ]
19
- num-bigint = " ^0.2.4"
19
+ num-bigint = { git = " https://github.com/rust-num/num-bigint" , default-features = false }
20
+
21
+ [features ]
22
+ default = [" std" ]
23
+ std = [" num-bigint/std" ]
Original file line number Diff line number Diff line change @@ -98,6 +98,7 @@ const SEEDS: [[u32; 16]; 3] = [
98
98
mod tests {
99
99
use super :: * ;
100
100
use crate :: code;
101
+ use crate :: std_alloc:: Vec ;
101
102
102
103
struct Test {
103
104
decrypted : & ' static str ,
Original file line number Diff line number Diff line change 1
1
//! Encrypt and decrypt cheat codes for CodeBreaker PS2 v7+.
2
2
3
3
use crate :: rc4:: Rc4 ;
4
+ use crate :: std_alloc:: Vec ;
4
5
5
- use std :: fmt;
6
- use std :: mem:: size_of;
7
- use std :: slice;
6
+ use core :: fmt;
7
+ use core :: mem:: size_of;
8
+ use core :: slice;
8
9
9
10
/// A processor for CB v7+ codes.
10
11
#[ derive( Clone , Copy ) ]
@@ -478,6 +479,7 @@ const SEEDS: [[u8; 256]; 5] = [
478
479
mod tests {
479
480
use super :: * ;
480
481
use crate :: code;
482
+ use crate :: std_alloc:: Vec ;
481
483
482
484
fn mul_tests ( ) -> Vec < ( u32 , u32 , u32 ) > {
483
485
vec ! [
Original file line number Diff line number Diff line change 30
30
#![ deny( clippy:: all, clippy:: nursery) ]
31
31
#![ deny( nonstandard_style, rust_2018_idioms) ]
32
32
#![ deny( missing_docs, missing_debug_implementations) ]
33
+ #![ no_std]
34
+
35
+ #[ cfg( feature = "std" ) ]
36
+ #[ macro_use]
37
+ extern crate std;
38
+
39
+ #[ cfg( feature = "std" ) ]
40
+ mod std_alloc {
41
+ #[ cfg( test) ]
42
+ pub ( crate ) use std:: string:: String ;
43
+ pub ( crate ) use std:: vec:: Vec ;
44
+ }
45
+
46
+ #[ cfg( not( feature = "std" ) ) ]
47
+ #[ allow( unused_imports) ]
48
+ #[ macro_use]
49
+ extern crate alloc;
50
+
51
+ #[ cfg( not( feature = "std" ) ) ]
52
+ mod std_alloc {
53
+ #[ cfg( test) ]
54
+ pub ( crate ) use alloc:: string:: String ;
55
+ pub ( crate ) use alloc:: vec:: Vec ;
56
+ }
33
57
34
58
pub mod cb1;
35
59
pub mod cb7;
@@ -286,6 +310,7 @@ fn num_code_lines(addr: u32) -> usize {
286
310
#[ cfg( test) ]
287
311
mod tests {
288
312
use super :: * ;
313
+ use crate :: std_alloc:: Vec ;
289
314
290
315
struct Test {
291
316
cb : Codebreaker ,
@@ -491,6 +516,8 @@ mod tests {
491
516
492
517
#[ cfg( test) ]
493
518
mod code {
519
+ use crate :: std_alloc:: { String , Vec } ;
520
+
494
521
pub ( crate ) fn parse ( line : & str ) -> ( u32 , u32 ) {
495
522
let code: Vec < u32 > = line
496
523
. splitn ( 2 , ' ' )
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ impl Rc4 {
38
38
#[ cfg( test) ]
39
39
mod tests {
40
40
use super :: * ;
41
+ use crate :: std_alloc:: Vec ;
41
42
42
43
struct Test {
43
44
key : & ' static str ,
You can’t perform that action at this time.
0 commit comments