Skip to content

Commit 194122c

Browse files
committed
Make data-url no_std compatible
1 parent 35653b0 commit 194122c

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

data-url/src/forgiving_base64.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//! <https://infra.spec.whatwg.org/#forgiving-base64-decode>
22
3+
use alloc::vec::Vec;
4+
35
#[derive(Debug)]
46
pub struct InvalidBase64(InvalidBase64Details);
57

data-url/src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@
1414
//! assert_eq!(body, b"Hello World!");
1515
//! assert!(fragment.is_none());
1616
//! ```
17+
#![no_std]
18+
19+
#[macro_use]
20+
extern crate alloc;
21+
22+
use alloc::{string::String, vec::Vec};
1723

1824
macro_rules! require {
1925
($condition: expr) => {

data-url/src/mime.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
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;
34

45
/// <https://mimesniff.spec.whatwg.org/#mime-type-representation>
56
#[derive(Debug, PartialEq, Eq)]

0 commit comments

Comments
 (0)