Debian Codegraph @

README.md

raw symbols SCIP
1 # data-url
2
3 [![crates.io](https://img.shields.io/crates/v/data-url.svg)](https://crates.io/crates/data-url)
4 [![docs.rs](https://img.shields.io/badge/docs.rs-%F0%9F%93%84-blue.svg)](https://docs.rs/data-url/)
5
6 Processing of `data:` URLs in Rust according to the Fetch Standard:
7 <https://fetch.spec.whatwg.org/#data-urls>
8 but starting from a string rather than a parsed URL to avoid extra copies.
9
10 ```rust
11 use data_url::{DataUrl, mime};
12
13 let url = DataUrl::process("data:,Hello%20World!").unwrap();
14 let (body, fragment) = url.decode_to_vec().unwrap();
15
16 assert!(url.mime_type().is("text", "plain"));
17 assert_eq!(url.mime_type().get_parameter("charset"), Some("US-ASCII"));
18 assert_eq!(body, b"Hello World!");
19 assert!(fragment.is_none());
20 ```