From de7dd90d3a83d28ba5c246c4e502d9ef8ea596e3 Mon Sep 17 00:00:00 2001 From: Ron Williams Date: Wed, 20 Dec 2023 14:54:11 -0800 Subject: [PATCH 1/4] add Redox scheme support --- src/lib.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 2b4840b0da..35108b7432 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1982,6 +1982,10 @@ pub enum Utf8Prefix<'a> { /// Prefix `C:` for the given disk drive. Disk(u8), + + /// Redox Scheme + #[cfg(target_os = "redox")] + Scheme(&'a str), } impl<'a> Utf8Prefix<'a> { @@ -2070,6 +2074,8 @@ impl<'a> Utf8PrefixComponent<'a> { Utf8Prefix::UNC(server, share) } Prefix::Disk(drive) => Utf8Prefix::Disk(drive), + #[cfg(target_os = "redox")] + Prefix::Scheme(scheme) => Utf8Prefix::Scheme(scheme), } } From bfb4fe290f6a6f08e10d063e4c6c7c4e4e002539 Mon Sep 17 00:00:00 2001 From: Ron Williams Date: Wed, 20 Dec 2023 15:03:36 -0800 Subject: [PATCH 2/4] remove target_os guard --- src/lib.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 35108b7432..5a0ea96955 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1984,7 +1984,6 @@ pub enum Utf8Prefix<'a> { Disk(u8), /// Redox Scheme - #[cfg(target_os = "redox")] Scheme(&'a str), } @@ -2074,7 +2073,6 @@ impl<'a> Utf8PrefixComponent<'a> { Utf8Prefix::UNC(server, share) } Prefix::Disk(drive) => Utf8Prefix::Disk(drive), - #[cfg(target_os = "redox")] Prefix::Scheme(scheme) => Utf8Prefix::Scheme(scheme), } } From 0a9805b9bd531f35c82ad5b95df28189a2e26de9 Mon Sep 17 00:00:00 2001 From: Ron Williams Date: Wed, 20 Dec 2023 15:07:28 -0800 Subject: [PATCH 3/4] put back target_os guard --- src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 5a0ea96955..35108b7432 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1984,6 +1984,7 @@ pub enum Utf8Prefix<'a> { Disk(u8), /// Redox Scheme + #[cfg(target_os = "redox")] Scheme(&'a str), } @@ -2073,6 +2074,7 @@ impl<'a> Utf8PrefixComponent<'a> { Utf8Prefix::UNC(server, share) } Prefix::Disk(drive) => Utf8Prefix::Disk(drive), + #[cfg(target_os = "redox")] Prefix::Scheme(scheme) => Utf8Prefix::Scheme(scheme), } } From 5bcea2c73a0c0b8ac2d5d414a261a3bfc0b2675c Mon Sep 17 00:00:00 2001 From: Ron Williams Date: Wed, 20 Dec 2023 15:10:57 -0800 Subject: [PATCH 4/4] assume utf8 for scheme --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 35108b7432..b513a67518 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2075,7 +2075,7 @@ impl<'a> Utf8PrefixComponent<'a> { } Prefix::Disk(drive) => Utf8Prefix::Disk(drive), #[cfg(target_os = "redox")] - Prefix::Scheme(scheme) => Utf8Prefix::Scheme(scheme), + Prefix::Scheme(scheme) => Utf8Prefix::Scheme(unsafe { str_assume_utf8(scheme) }), } }