Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/test-utils/src/minicore.rs')
-rw-r--r--crates/test-utils/src/minicore.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/crates/test-utils/src/minicore.rs b/crates/test-utils/src/minicore.rs
index 4a44eaf5d1..fd06736a25 100644
--- a/crates/test-utils/src/minicore.rs
+++ b/crates/test-utils/src/minicore.rs
@@ -1574,6 +1574,15 @@ pub mod str {
pub const unsafe fn from_utf8_unchecked(v: &[u8]) -> &str {
""
}
+ pub trait FromStr: Sized {
+ type Err;
+ fn from_str(s: &str) -> Result<Self, Self::Err>;
+ }
+ impl str {
+ pub fn parse<F: FromStr>(&self) -> Result<F, F::Err> {
+ FromStr::from_str(self)
+ }
+ }
}
// endregion:str
@@ -1848,6 +1857,7 @@ pub mod prelude {
option::Option::{self, None, Some}, // :option
panic, // :panic
result::Result::{self, Err, Ok}, // :result
+ str::FromStr, // :str
};
}