File tree Expand file tree Collapse file tree 4 files changed +24
-2
lines changed Expand file tree Collapse file tree 4 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -3,12 +3,18 @@ name = "data-url"
3
3
version = " 0.2.0"
4
4
authors = [" Simon Sapin <simon.sapin@exyr.org>" ]
5
5
description = " Processing of data: URL according to WHATWG’s Fetch Standard"
6
+ categories = [" no_std" ]
6
7
repository = " https://github.com/servo/rust-url"
7
8
license = " MIT OR Apache-2.0"
8
9
edition = " 2018"
9
10
autotests = false
10
11
rust-version = " 1.51"
11
12
13
+ [features ]
14
+ default = [" std" ]
15
+ std = [" alloc" ]
16
+ alloc = []
17
+
12
18
[dev-dependencies ]
13
19
tester = " 0.9"
14
20
serde = {version = " 1.0" , features = [" derive" ]}
Original file line number Diff line number Diff line change 1
1
//! <https://infra.spec.whatwg.org/#forgiving-base64-decode>
2
2
3
+ use alloc:: vec:: Vec ;
4
+
3
5
#[ derive( Debug ) ]
4
6
pub struct InvalidBase64 ( InvalidBase64Details ) ;
5
7
Original file line number Diff line number Diff line change 14
14
//! assert_eq!(body, b"Hello World!");
15
15
//! assert!(fragment.is_none());
16
16
//! ```
17
+ #![ no_std]
18
+
19
+ // For forwards compatibility
20
+ #[ cfg( feature = "std" ) ]
21
+ extern crate std as _;
22
+
23
+ #[ macro_use]
24
+ extern crate alloc;
25
+
26
+ #[ cfg( not( feature = "alloc" ) ) ]
27
+ compile_error ! ( "the `alloc` feature must currently be enabled" ) ;
28
+
29
+ use alloc:: { string:: String , vec:: Vec } ;
17
30
18
31
macro_rules! require {
19
32
( $condition: expr) => {
Original file line number Diff line number Diff line change 1
- use std:: fmt:: { self , Write } ;
2
- use std:: str:: FromStr ;
1
+ use alloc:: { borrow:: ToOwned , string:: String , vec:: Vec } ;
2
+ use core:: fmt:: { self , Write } ;
3
+ use core:: str:: FromStr ;
3
4
4
5
/// <https://mimesniff.spec.whatwg.org/#mime-type-representation>
5
6
#[ derive( Debug , PartialEq , Eq ) ]
You can’t perform that action at this time.
0 commit comments