diff options
Diffstat (limited to 'vendor/bstr')
-rw-r--r-- | vendor/bstr/.cargo-checksum.json | 2 | ||||
-rw-r--r-- | vendor/bstr/Cargo.lock | 2 | ||||
-rw-r--r-- | vendor/bstr/Cargo.toml | 4 | ||||
-rw-r--r-- | vendor/bstr/src/ascii.rs | 6 | ||||
-rw-r--r-- | vendor/bstr/src/byteset/scalar.rs | 6 | ||||
-rw-r--r-- | vendor/bstr/src/escape_bytes.rs | 6 | ||||
-rw-r--r-- | vendor/bstr/src/impls.rs | 86 |
7 files changed, 97 insertions, 15 deletions
diff --git a/vendor/bstr/.cargo-checksum.json b/vendor/bstr/.cargo-checksum.json index 57f8c3c3b..90c0ab073 100644 --- a/vendor/bstr/.cargo-checksum.json +++ b/vendor/bstr/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"COPYING":"68653aaa727a2bfa31b7a751e31701ce33c49d695c12dd291a07d1c54da4c14b","Cargo.lock":"01a3a44ed3940a7525419e6422b631b4158ffa3ff2c867990a37fbfd3e600bb6","Cargo.toml":"8c73af775af87d01e76538c541dd34947510ab4353c73050017a6f4db12a4413","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6b7374c39a57e57fc2c38eb529c4c88340152b10f51dd5ae2d819dfa67f61715","README.md":"5e20af8472e06926761584e3c249ebc8b9802f1eb13440276d9aa267e70e5955","examples/graphemes-std.rs":"100264f623ff973be76831fb1d4519e6f371b21972d6577bb49bf7bbff4d0d5e","examples/graphemes.rs":"401c5fac813f78e4029ece9c98bccb3128637c507d8667b73e069bfbc9d7f2f4","examples/lines-std.rs":"094a48bfd483ec01f80f9c937ddfe6f0bdbf09f960ba822215ec8ed9862624df","examples/lines.rs":"65ae4edbdb0ccff8ff40cdc70b4e7a70824f5028daff2e1b2a3247f884589db8","examples/uppercase-std.rs":"33aed88e38483aa303625757304a974594476a3a659d8bdd4877aceb90ff8be3","examples/uppercase.rs":"2cdf7f173cb6a5d4c16a967e3f733bc40331f5167da519c5194ceee187ff814f","examples/words-std.rs":"ffde2fccd361890fab0e0b051915a749d5d51e95b9be700b76fada231d002f00","examples/words.rs":"aa805faa5012714428ef895596947c333417c2b16a7e0155d4a128be7428fc17","rustfmt.toml":"1ca600239a27401c4a43f363cf3f38183a212affc1f31bff3ae93234bbaec228","scripts/generate-unicode-data":"75d68617b5acf564cc681ddfbf77a6097eaa9a9f8f54af4e16905dda3dc6df77","scripts/regex/grapheme.sh":"d796bca73278f6ab04d65f285b2dc72efcad76874f98f4bfa22bf38f2eaeece7","scripts/regex/sentence.sh":"7892e07ac9e450967bd79279558cbef2f0fc0b0aefab24217910937ed6330f06","scripts/regex/word.sh":"b3f53e2331e9e50a1a7232b7d278aaecace6a42ef6c16dd0b8d0ec59fd2aaf4f","src/ascii.rs":"3a2ffadf7b0529e8a475a8d2776d02e7fd149984de22a89fa158647e9c54bb77","src/bstr.rs":"be1313d13814f3818068f1f6c96e4a1eecf1ecdec42c360f90379596804ea0ef","src/bstring.rs":"1cd7656dc3a6eded742eb7e9e43c83a5d020e6a419060c186788c8e1010f7dcc","src/byteset/mod.rs":"3f88d5594d95724c6eda96f79006a27dab80c4f849f00342b0bae3efedc32c45","src/byteset/scalar.rs":"558daee3ca4bc774ab7d808b5ac45942962ef53af97f221cc01c0fab9cb32c8b","src/escape_bytes.rs":"3bd168a350f8e96b39c4b9433abf779e34d5f66345b1c427118f5609f5d3398d","src/ext_slice.rs":"9e849981a4b4288b3d1237372847c81a6068186f041c8b04cab901a87a2bcc82","src/ext_vec.rs":"4dd9af267c07554051787c752e22e091684eb93f1a70c70ac2537535d1a54a07","src/impls.rs":"0a58c6a02c558c0c26b895d6aeab6997b41c6dd5051ceb596e2c2283ab11dce4","src/io.rs":"73afcb89230d940b17a5917696c3f7c55267aefcb42db4164062dbf18875b677","src/lib.rs":"b4433d15492fe85983cbe1bf23249d1dac54aa5df4510989939933a43bfd07f9","src/tests.rs":"8adfd1a4a9da91b2a4dff25ffafcf99d914be3f5b7d67d66cdcb40a2d72abd04","src/unicode/data/GraphemeBreakTest.txt":"ddc7d4d1f3838573b94fc5d83ff7217e63c47b22ae1cd40c5fe1a54efc15589b","src/unicode/data/LICENSE-UNICODE":"8b9babb256418ec15761d635a49f973424939affba7a0a88de2fc2690e454a23","src/unicode/data/SentenceBreakTest.txt":"7e42dd749dbb94aa44b13faf9df6319d9a16ce2ea09a3a094fcfbb5962168040","src/unicode/data/WordBreakTest.txt":"8094b544ec1580c7e41ac0187805cc1aeb330a90301ec7505563e1a59318284e","src/unicode/fsm/grapheme_break_fwd.bigendian.dfa":"ae5220a77570720fcf78e63794d4cddbeef365fc3aaeec7dde391c229bc0a840","src/unicode/fsm/grapheme_break_fwd.littleendian.dfa":"3f9ce5d78325ede1651587e24e12357740a90608c784ac59c643abd42c4d9a83","src/unicode/fsm/grapheme_break_fwd.rs":"b6d937ec3afee23ea7c01ff9c0eeff1fc4f85287b87659dca80765db49d6b09e","src/unicode/fsm/grapheme_break_rev.bigendian.dfa":"fa2c745adc61060f08e5734f19acc09de387b0abd671597a543b4d4d80fd7a04","src/unicode/fsm/grapheme_break_rev.littleendian.dfa":"a10fd82f63b0f0aa08e5e7f09000c020c7ff4cfe6240afb11a615c663100de99","src/unicode/fsm/grapheme_break_rev.rs":"d9de2be51a17c5be37142ac44b9e2f0627c05a9101d5b1e23fd78229ca0ef75d","src/unicode/fsm/mod.rs":"50b8baa692e83f909a0fe62eced9666b712a68b6c7bf42976c8cc37e49dd9b64","src/unicode/fsm/regional_indicator_rev.bigendian.dfa":"db9db4c86bced5f4aaf68d5e475e13e5d4976c237deec13c192111a399aa5858","src/unicode/fsm/regional_indicator_rev.littleendian.dfa":"0905f70acddd423c1b53bfbeb73299009f724400029d7f9a987d63c32d36e36c","src/unicode/fsm/regional_indicator_rev.rs":"50b89fc6f7d461c789e88cc6f1a769257104b7f45eb01bd31047e898f1e9587a","src/unicode/fsm/sentence_break_fwd.bigendian.dfa":"0cd36026a86ea5d2e4710b8278733982808e341c88b62c4f9ca309417a181dc9","src/unicode/fsm/sentence_break_fwd.littleendian.dfa":"f3b85da014d1c94e1b444f3fca2952d1a5fbf2a9f42e32574eb52e027a797281","src/unicode/fsm/sentence_break_fwd.rs":"2c6147825fd78c15ecdb952d368d519f81bbf196eedf3e90e927699e832c7080","src/unicode/fsm/simple_word_fwd.bigendian.dfa":"635ab3e9c589268ef91a48c8b9b038e156deaf4a9a4475fce49ca75eabddccf7","src/unicode/fsm/simple_word_fwd.littleendian.dfa":"4f92b789385027a9276498a829cc8e5a3ecdd5f3c6d88254c6cd23d95d828c57","src/unicode/fsm/simple_word_fwd.rs":"44a2b90c8b4a2fa50c66cacc1d48afd47a8f7aa4753dd391471b48a9a891be71","src/unicode/fsm/whitespace_anchored_fwd.bigendian.dfa":"593c8ad059ab0bee60a2ea25f4c1fc89c105cb19a9bda3fa98d1464b8e87cfc0","src/unicode/fsm/whitespace_anchored_fwd.littleendian.dfa":"a04ed70d5dbd969c0af0e12bec5033ca910161c486f741dd0a792d2e5b0cc6f6","src/unicode/fsm/whitespace_anchored_fwd.rs":"e0f3f0be717ff306409ea9242f507847c4c0fa7469eccbd98a849389afe7fd26","src/unicode/fsm/whitespace_anchored_rev.bigendian.dfa":"9ab09359ce73058d22e5bfa857e040831d49f4a53dd25da804136e9db9e7f5fb","src/unicode/fsm/whitespace_anchored_rev.littleendian.dfa":"cb5804786bd98bfe0726f3f7733d72bc1d69130c8a8b026465c03c78f8c8ac79","src/unicode/fsm/whitespace_anchored_rev.rs":"8f27a50dfe549db99e768225c2956489f233f5a4986857a5ff5f2b507375a69d","src/unicode/fsm/word_break_fwd.bigendian.dfa":"72278d401ac119d50e06c6b8a4cb29d54366d1da536cfaedc3a20bb8cc1b742c","src/unicode/fsm/word_break_fwd.littleendian.dfa":"97dcdca86472d96faadd15d1c0328a76484971f3c4ad409c29049791cb9ed3eb","src/unicode/fsm/word_break_fwd.rs":"3ce6b28015dd6f2b330759da46263e8227f921e2370d4aa6922b8be26db558a8","src/unicode/grapheme.rs":"9bac56709754b48d42ee35282d5752c554a5af3e70b08c01977872f70ffa2afd","src/unicode/mod.rs":"fc67b0d64e9395398235c8663706b246edc0742e6cfe87057eeabdb1b19ad28d","src/unicode/sentence.rs":"8af1f274f80120b04928a6e560bfb3f2c9176d882f729265494b1a796a370681","src/unicode/whitespace.rs":"1fe313906fce009060267ae14de10e0ce577f0e2e2018273ee79d008dc9cf2f5","src/unicode/word.rs":"ed1bef53cf01ef6e682898e802e1654356a763c3993b4f16898eb5ed4b5e7637","src/utf8.rs":"e759713023dc3e5f9f5b2e6c3ba601af591ce5b2ad71aba729e3c29bcf6007e3"},"package":"c3d4260bcc2e8fc9df1eac4919a720effeb63a3f0952f5bf4944adfa18897f09"}
\ No newline at end of file +{"files":{"COPYING":"68653aaa727a2bfa31b7a751e31701ce33c49d695c12dd291a07d1c54da4c14b","Cargo.lock":"89aebb25a85f875bc2ccc3a90cf4a2c86dff11f95ff90ddb1f208d65a9fc85fb","Cargo.toml":"665a9c704132b7dd3b6dc75ba3ca772cf8bc5a28f33012943af94ca1bc4f85ad","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6b7374c39a57e57fc2c38eb529c4c88340152b10f51dd5ae2d819dfa67f61715","README.md":"5e20af8472e06926761584e3c249ebc8b9802f1eb13440276d9aa267e70e5955","examples/graphemes-std.rs":"100264f623ff973be76831fb1d4519e6f371b21972d6577bb49bf7bbff4d0d5e","examples/graphemes.rs":"401c5fac813f78e4029ece9c98bccb3128637c507d8667b73e069bfbc9d7f2f4","examples/lines-std.rs":"094a48bfd483ec01f80f9c937ddfe6f0bdbf09f960ba822215ec8ed9862624df","examples/lines.rs":"65ae4edbdb0ccff8ff40cdc70b4e7a70824f5028daff2e1b2a3247f884589db8","examples/uppercase-std.rs":"33aed88e38483aa303625757304a974594476a3a659d8bdd4877aceb90ff8be3","examples/uppercase.rs":"2cdf7f173cb6a5d4c16a967e3f733bc40331f5167da519c5194ceee187ff814f","examples/words-std.rs":"ffde2fccd361890fab0e0b051915a749d5d51e95b9be700b76fada231d002f00","examples/words.rs":"aa805faa5012714428ef895596947c333417c2b16a7e0155d4a128be7428fc17","rustfmt.toml":"1ca600239a27401c4a43f363cf3f38183a212affc1f31bff3ae93234bbaec228","scripts/generate-unicode-data":"75d68617b5acf564cc681ddfbf77a6097eaa9a9f8f54af4e16905dda3dc6df77","scripts/regex/grapheme.sh":"d796bca73278f6ab04d65f285b2dc72efcad76874f98f4bfa22bf38f2eaeece7","scripts/regex/sentence.sh":"7892e07ac9e450967bd79279558cbef2f0fc0b0aefab24217910937ed6330f06","scripts/regex/word.sh":"b3f53e2331e9e50a1a7232b7d278aaecace6a42ef6c16dd0b8d0ec59fd2aaf4f","src/ascii.rs":"5aae67428421ad9e2156d7b27f5931bd924056b9af073ec53c44ef8e2d29cc8a","src/bstr.rs":"be1313d13814f3818068f1f6c96e4a1eecf1ecdec42c360f90379596804ea0ef","src/bstring.rs":"1cd7656dc3a6eded742eb7e9e43c83a5d020e6a419060c186788c8e1010f7dcc","src/byteset/mod.rs":"3f88d5594d95724c6eda96f79006a27dab80c4f849f00342b0bae3efedc32c45","src/byteset/scalar.rs":"fb84085b30d2901407877eb306828574eaf0dea907bbb7f02c36f24f0dc6f7b6","src/escape_bytes.rs":"207b7b92398912f940f911cfaafca04b7c62dac1106063ae2c7bd0676238b4cf","src/ext_slice.rs":"9e849981a4b4288b3d1237372847c81a6068186f041c8b04cab901a87a2bcc82","src/ext_vec.rs":"4dd9af267c07554051787c752e22e091684eb93f1a70c70ac2537535d1a54a07","src/impls.rs":"cd585f19d96f06b35cb17a7a8479f14f6b624beecf01501ea077f4b8eaacced4","src/io.rs":"73afcb89230d940b17a5917696c3f7c55267aefcb42db4164062dbf18875b677","src/lib.rs":"b4433d15492fe85983cbe1bf23249d1dac54aa5df4510989939933a43bfd07f9","src/tests.rs":"8adfd1a4a9da91b2a4dff25ffafcf99d914be3f5b7d67d66cdcb40a2d72abd04","src/unicode/data/GraphemeBreakTest.txt":"ddc7d4d1f3838573b94fc5d83ff7217e63c47b22ae1cd40c5fe1a54efc15589b","src/unicode/data/LICENSE-UNICODE":"8b9babb256418ec15761d635a49f973424939affba7a0a88de2fc2690e454a23","src/unicode/data/SentenceBreakTest.txt":"7e42dd749dbb94aa44b13faf9df6319d9a16ce2ea09a3a094fcfbb5962168040","src/unicode/data/WordBreakTest.txt":"8094b544ec1580c7e41ac0187805cc1aeb330a90301ec7505563e1a59318284e","src/unicode/fsm/grapheme_break_fwd.bigendian.dfa":"ae5220a77570720fcf78e63794d4cddbeef365fc3aaeec7dde391c229bc0a840","src/unicode/fsm/grapheme_break_fwd.littleendian.dfa":"3f9ce5d78325ede1651587e24e12357740a90608c784ac59c643abd42c4d9a83","src/unicode/fsm/grapheme_break_fwd.rs":"b6d937ec3afee23ea7c01ff9c0eeff1fc4f85287b87659dca80765db49d6b09e","src/unicode/fsm/grapheme_break_rev.bigendian.dfa":"fa2c745adc61060f08e5734f19acc09de387b0abd671597a543b4d4d80fd7a04","src/unicode/fsm/grapheme_break_rev.littleendian.dfa":"a10fd82f63b0f0aa08e5e7f09000c020c7ff4cfe6240afb11a615c663100de99","src/unicode/fsm/grapheme_break_rev.rs":"d9de2be51a17c5be37142ac44b9e2f0627c05a9101d5b1e23fd78229ca0ef75d","src/unicode/fsm/mod.rs":"50b8baa692e83f909a0fe62eced9666b712a68b6c7bf42976c8cc37e49dd9b64","src/unicode/fsm/regional_indicator_rev.bigendian.dfa":"db9db4c86bced5f4aaf68d5e475e13e5d4976c237deec13c192111a399aa5858","src/unicode/fsm/regional_indicator_rev.littleendian.dfa":"0905f70acddd423c1b53bfbeb73299009f724400029d7f9a987d63c32d36e36c","src/unicode/fsm/regional_indicator_rev.rs":"50b89fc6f7d461c789e88cc6f1a769257104b7f45eb01bd31047e898f1e9587a","src/unicode/fsm/sentence_break_fwd.bigendian.dfa":"0cd36026a86ea5d2e4710b8278733982808e341c88b62c4f9ca309417a181dc9","src/unicode/fsm/sentence_break_fwd.littleendian.dfa":"f3b85da014d1c94e1b444f3fca2952d1a5fbf2a9f42e32574eb52e027a797281","src/unicode/fsm/sentence_break_fwd.rs":"2c6147825fd78c15ecdb952d368d519f81bbf196eedf3e90e927699e832c7080","src/unicode/fsm/simple_word_fwd.bigendian.dfa":"635ab3e9c589268ef91a48c8b9b038e156deaf4a9a4475fce49ca75eabddccf7","src/unicode/fsm/simple_word_fwd.littleendian.dfa":"4f92b789385027a9276498a829cc8e5a3ecdd5f3c6d88254c6cd23d95d828c57","src/unicode/fsm/simple_word_fwd.rs":"44a2b90c8b4a2fa50c66cacc1d48afd47a8f7aa4753dd391471b48a9a891be71","src/unicode/fsm/whitespace_anchored_fwd.bigendian.dfa":"593c8ad059ab0bee60a2ea25f4c1fc89c105cb19a9bda3fa98d1464b8e87cfc0","src/unicode/fsm/whitespace_anchored_fwd.littleendian.dfa":"a04ed70d5dbd969c0af0e12bec5033ca910161c486f741dd0a792d2e5b0cc6f6","src/unicode/fsm/whitespace_anchored_fwd.rs":"e0f3f0be717ff306409ea9242f507847c4c0fa7469eccbd98a849389afe7fd26","src/unicode/fsm/whitespace_anchored_rev.bigendian.dfa":"9ab09359ce73058d22e5bfa857e040831d49f4a53dd25da804136e9db9e7f5fb","src/unicode/fsm/whitespace_anchored_rev.littleendian.dfa":"cb5804786bd98bfe0726f3f7733d72bc1d69130c8a8b026465c03c78f8c8ac79","src/unicode/fsm/whitespace_anchored_rev.rs":"8f27a50dfe549db99e768225c2956489f233f5a4986857a5ff5f2b507375a69d","src/unicode/fsm/word_break_fwd.bigendian.dfa":"72278d401ac119d50e06c6b8a4cb29d54366d1da536cfaedc3a20bb8cc1b742c","src/unicode/fsm/word_break_fwd.littleendian.dfa":"97dcdca86472d96faadd15d1c0328a76484971f3c4ad409c29049791cb9ed3eb","src/unicode/fsm/word_break_fwd.rs":"3ce6b28015dd6f2b330759da46263e8227f921e2370d4aa6922b8be26db558a8","src/unicode/grapheme.rs":"9bac56709754b48d42ee35282d5752c554a5af3e70b08c01977872f70ffa2afd","src/unicode/mod.rs":"fc67b0d64e9395398235c8663706b246edc0742e6cfe87057eeabdb1b19ad28d","src/unicode/sentence.rs":"8af1f274f80120b04928a6e560bfb3f2c9176d882f729265494b1a796a370681","src/unicode/whitespace.rs":"1fe313906fce009060267ae14de10e0ce577f0e2e2018273ee79d008dc9cf2f5","src/unicode/word.rs":"ed1bef53cf01ef6e682898e802e1654356a763c3993b4f16898eb5ed4b5e7637","src/utf8.rs":"e759713023dc3e5f9f5b2e6c3ba601af591ce5b2ad71aba729e3c29bcf6007e3"},"package":"a246e68bb43f6cd9db24bea052a53e40405417c5fb372e3d1a8a7f770a564ef5"}
\ No newline at end of file diff --git a/vendor/bstr/Cargo.lock b/vendor/bstr/Cargo.lock index 116430881..7d9e05482 100644 --- a/vendor/bstr/Cargo.lock +++ b/vendor/bstr/Cargo.lock @@ -4,7 +4,7 @@ version = 3 [[package]] name = "bstr" -version = "1.4.0" +version = "1.5.0" dependencies = [ "memchr", "once_cell", diff --git a/vendor/bstr/Cargo.toml b/vendor/bstr/Cargo.toml index 97f6d733a..f644ee2a8 100644 --- a/vendor/bstr/Cargo.toml +++ b/vendor/bstr/Cargo.toml @@ -13,7 +13,7 @@ edition = "2021" rust-version = "1.60" name = "bstr" -version = "1.4.0" +version = "1.5.0" authors = ["Andrew Gallant <jamslam@gmail.com>"] exclude = ["/.github"] description = "A string type that is not required to be valid UTF-8." @@ -43,7 +43,7 @@ rustdoc-args = [ ] [profile.release] -debug = true +debug = 2 [lib] bench = false diff --git a/vendor/bstr/src/ascii.rs b/vendor/bstr/src/ascii.rs index 259d41fe7..5bbbdad82 100644 --- a/vendor/bstr/src/ascii.rs +++ b/vendor/bstr/src/ascii.rs @@ -1,5 +1,3 @@ -use core::mem; - // The following ~400 lines of code exists for exactly one purpose, which is // to optimize this code: // @@ -24,7 +22,7 @@ use core::mem; // _mm_movemask_epi8. #[cfg(any(test, miri, not(target_arch = "x86_64")))] -const USIZE_BYTES: usize = mem::size_of::<usize>(); +const USIZE_BYTES: usize = core::mem::size_of::<usize>(); #[cfg(any(test, miri, not(target_arch = "x86_64")))] const FALLBACK_LOOP_SIZE: usize = 2 * USIZE_BYTES; @@ -119,7 +117,7 @@ fn first_non_ascii_byte_fallback(slice: &[u8]) -> usize { fn first_non_ascii_byte_sse2(slice: &[u8]) -> usize { use core::arch::x86_64::*; - const VECTOR_SIZE: usize = mem::size_of::<__m128i>(); + const VECTOR_SIZE: usize = core::mem::size_of::<__m128i>(); const VECTOR_ALIGN: usize = VECTOR_SIZE - 1; const VECTOR_LOOP_SIZE: usize = 4 * VECTOR_SIZE; diff --git a/vendor/bstr/src/byteset/scalar.rs b/vendor/bstr/src/byteset/scalar.rs index 28bff673d..46ebfba1e 100644 --- a/vendor/bstr/src/byteset/scalar.rs +++ b/vendor/bstr/src/byteset/scalar.rs @@ -4,11 +4,7 @@ use core::{cmp, usize}; -#[cfg(target_pointer_width = "32")] -const USIZE_BYTES: usize = 4; - -#[cfg(target_pointer_width = "64")] -const USIZE_BYTES: usize = 8; +const USIZE_BYTES: usize = core::mem::size_of::<usize>(); // The number of bytes to loop at in one iteration of memchr/memrchr. const LOOP_SIZE: usize = 2 * USIZE_BYTES; diff --git a/vendor/bstr/src/escape_bytes.rs b/vendor/bstr/src/escape_bytes.rs index 62c1fcdda..b6775055c 100644 --- a/vendor/bstr/src/escape_bytes.rs +++ b/vendor/bstr/src/escape_bytes.rs @@ -129,11 +129,13 @@ enum EscapeState { /// expose this for core-only use cases too. I'm just not quite sure what the /// API should be. #[derive(Clone, Debug)] +#[cfg(feature = "alloc")] pub(crate) struct UnescapeBytes<I> { it: I, state: UnescapeState, } +#[cfg(feature = "alloc")] impl<I: Iterator<Item = char>> UnescapeBytes<I> { pub(crate) fn new<T: IntoIterator<IntoIter = I>>( t: T, @@ -142,6 +144,7 @@ impl<I: Iterator<Item = char>> UnescapeBytes<I> { } } +#[cfg(feature = "alloc")] impl<I: Iterator<Item = char>> Iterator for UnescapeBytes<I> { type Item = u8; @@ -265,6 +268,7 @@ impl<I: Iterator<Item = char>> Iterator for UnescapeBytes<I> { /// The state used by the FSM in the unescaping iterator. #[derive(Clone, Debug)] +#[cfg(feature = "alloc")] enum UnescapeState { /// The start state. Look for an escape sequence, otherwise emit the next /// codepoint as-is. @@ -283,6 +287,7 @@ enum UnescapeState { HexSecond(char), } +#[cfg(feature = "alloc")] impl UnescapeState { /// Create a new `Bytes` variant with the given slice. /// @@ -337,6 +342,7 @@ impl UnescapeState { /// # Panics /// /// This panics if `ch` is not in `[0-9A-Fa-f]`. +#[cfg(feature = "alloc")] fn char_to_hexdigit(ch: char) -> u8 { u8::try_from(ch.to_digit(16).unwrap()).unwrap() } diff --git a/vendor/bstr/src/impls.rs b/vendor/bstr/src/impls.rs index e017cf1ac..861ca5376 100644 --- a/vendor/bstr/src/impls.rs +++ b/vendor/bstr/src/impls.rs @@ -66,7 +66,7 @@ mod bstring { }; use alloc::{ - borrow::{Borrow, Cow, ToOwned}, + borrow::{Borrow, BorrowMut, Cow, ToOwned}, string::String, vec, vec::Vec, @@ -134,6 +134,13 @@ mod bstring { } } + impl Borrow<[u8]> for BString { + #[inline] + fn borrow(&self) -> &[u8] { + self.as_bytes() + } + } + impl Borrow<BStr> for BString { #[inline] fn borrow(&self) -> &BStr { @@ -141,6 +148,41 @@ mod bstring { } } + impl Borrow<BStr> for Vec<u8> { + #[inline] + fn borrow(&self) -> &BStr { + self.as_slice().as_bstr() + } + } + + impl Borrow<BStr> for String { + #[inline] + fn borrow(&self) -> &BStr { + self.as_bytes().as_bstr() + } + } + + impl BorrowMut<[u8]> for BString { + #[inline] + fn borrow_mut(&mut self) -> &mut [u8] { + self.as_bytes_mut() + } + } + + impl BorrowMut<BStr> for BString { + #[inline] + fn borrow_mut(&mut self) -> &mut BStr { + self.as_mut_bstr() + } + } + + impl BorrowMut<BStr> for Vec<u8> { + #[inline] + fn borrow_mut(&mut self) -> &mut BStr { + BStr::new_mut(self.as_mut_slice()) + } + } + impl ToOwned for BStr { type Owned = BString; @@ -338,7 +380,12 @@ mod bstring { } mod bstr { - use core::{cmp::Ordering, convert::TryFrom, fmt, ops}; + use core::{ + borrow::{Borrow, BorrowMut}, + cmp::Ordering, + convert::TryFrom, + fmt, ops, + }; #[cfg(feature = "alloc")] use alloc::{borrow::Cow, boxed::Box, string::String, vec::Vec}; @@ -612,6 +659,41 @@ mod bstr { } } + impl Borrow<BStr> for [u8] { + #[inline] + fn borrow(&self) -> &BStr { + self.as_bstr() + } + } + + impl Borrow<BStr> for str { + #[inline] + fn borrow(&self) -> &BStr { + self.as_bytes().as_bstr() + } + } + + impl Borrow<[u8]> for BStr { + #[inline] + fn borrow(&self) -> &[u8] { + self.as_bytes() + } + } + + impl BorrowMut<BStr> for [u8] { + #[inline] + fn borrow_mut(&mut self) -> &mut BStr { + BStr::new_mut(self) + } + } + + impl BorrowMut<[u8]> for BStr { + #[inline] + fn borrow_mut(&mut self) -> &mut [u8] { + self.as_bytes_mut() + } + } + impl<'a> Default for &'a BStr { fn default() -> &'a BStr { BStr::from_bytes(b"") |