Skip to content

Commit 2fb5410

Browse files
CryZeRReverser
andauthored
Implement support for no_std
* Implement support for no_std * Disable no_std in doctests on stable Rust See #1 (comment). * Rename `alloc` import to `std` This is to avoid confusion between link docs and regular types. Co-authored-by: Ingvar Stepanyan <[email protected]>
1 parent 8588367 commit 2fb5410

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ edition = "2018"
66
license = "MIT"
77
description = "Copy-on-write string utilities for Rust"
88
repository = "https://github.com/RReverser/cow-utils-rs"
9-
categories = ["text-processing"]
9+
categories = ["no-std", "text-processing"]
1010
keywords = ["string", "str", "text", "cow"]
1111
readme = "README.md"
1212

src/lib.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1+
// Disable no_std in doctests on stable Rust.
2+
// See https://github.com/RReverser/cow-utils-rs/pull/1#issuecomment-586973518.
3+
#![cfg_attr(any(not(doctest), feature = "nightly"), no_std)]
14
#![cfg_attr(feature = "nightly", feature(pattern))]
25

3-
use std::borrow::Cow;
6+
extern crate alloc as std;
7+
8+
use std::{
9+
borrow::{Cow, ToOwned},
10+
string::String,
11+
};
412

513
/// This trait is a shim for the required functionality
614
/// normally provided directly by [`std::str::pattern::Pattern`]

0 commit comments

Comments
 (0)