1#![allow(clippy::cognitive_complexity)]
268#![allow(clippy::float_cmp)]
269#![deny(nonstandard_style)]
270#![deny(future_incompatible)]
271#![deny(rust_2018_idioms)]
272#![deny(unsafe_code)]
273#![warn(missing_docs)]
274#![warn(unused)]
275
276use std::borrow::{Borrow, Cow};
277use std::cmp::Ordering;
278use std::convert::Infallible;
279use std::ffi::{OsStr, OsString};
280use std::hash::{Hash, Hasher};
281use std::ops::{Deref, DerefMut, Div};
282use std::path::{Iter, Path, PathBuf};
283use std::rc::Rc;
284use std::str::FromStr;
285use std::sync::Arc;
286
287#[cfg(test)]
288mod tests;
289
290#[derive(Debug, Clone, Default)]
300#[repr(transparent)]
301pub struct PathDSL {
302 path: PathBuf,
303}
304
305impl PathDSL {
306 #[inline(always)]
308 pub fn new() -> Self {
309 PathDSL { path: PathBuf::new() }
310 }
311
312 #[inline(always)]
314 pub fn into_os_string(self) -> OsString {
315 self.path.into_os_string()
316 }
317
318 #[inline(always)]
320 pub fn into_boxed_path(self) -> Box<Path> {
321 self.path.into_boxed_path()
322 }
323
324 #[inline(always)]
326 pub fn into_pathbuf(self) -> PathBuf {
327 self.into()
328 }
329}
330
331impl AsRef<Path> for PathDSL {
336 #[inline(always)]
337 fn as_ref(&self) -> &Path {
338 self.path.as_ref()
339 }
340}
341
342impl AsMut<PathBuf> for PathDSL {
343 #[inline(always)]
344 fn as_mut(&mut self) -> &mut PathBuf {
345 &mut self.path
346 }
347}
348
349impl AsRef<OsStr> for PathDSL {
350 #[inline(always)]
351 fn as_ref(&self) -> &OsStr {
352 self.path.as_ref()
353 }
354}
355
356impl Deref for PathDSL {
357 type Target = PathBuf;
358
359 #[inline(always)]
360 fn deref(&self) -> &Self::Target {
361 &self.path
362 }
363}
364
365impl DerefMut for PathDSL {
366 #[inline(always)]
367 fn deref_mut(&mut self) -> &mut Self::Target {
368 &mut self.path
369 }
370}
371
372impl<T> From<&T> for PathDSL
377where
378 T: AsRef<Path> + ?Sized,
379{
380 #[inline(always)]
381 fn from(other: &T) -> Self {
382 PathDSL {
383 path: PathBuf::from(other.as_ref()),
384 }
385 }
386}
387
388impl<T> From<&mut T> for PathDSL
389where
390 T: AsRef<Path> + ?Sized,
391{
392 #[inline(always)]
393 fn from(other: &mut T) -> Self {
394 PathDSL {
395 path: PathBuf::from(other.as_ref()),
396 }
397 }
398}
399
400impl From<PathBuf> for PathDSL {
401 #[inline(always)]
402 fn from(other: PathBuf) -> Self {
403 PathDSL { path: other }
404 }
405}
406
407impl From<OsString> for PathDSL {
408 #[inline(always)]
409 fn from(other: OsString) -> Self {
410 PathDSL {
411 path: PathBuf::from(other),
412 }
413 }
414}
415
416impl From<String> for PathDSL {
417 #[inline(always)]
418 fn from(other: String) -> Self {
419 PathDSL {
420 path: PathBuf::from(other),
421 }
422 }
423}
424
425impl From<Box<Path>> for PathDSL {
426 #[inline(always)]
427 fn from(other: Box<Path>) -> Self {
428 PathDSL {
429 path: PathBuf::from(other),
430 }
431 }
432}
433
434impl From<Cow<'_, Path>> for PathDSL {
435 #[inline(always)]
436 fn from(other: Cow<'_, Path>) -> Self {
437 PathDSL {
438 path: PathBuf::from(other),
439 }
440 }
441}
442
443impl From<Cow<'_, OsStr>> for PathDSL {
444 #[inline(always)]
445 fn from(other: Cow<'_, OsStr>) -> Self {
446 PathDSL {
447 path: PathBuf::from(&*other),
448 }
449 }
450}
451
452impl Into<PathBuf> for PathDSL {
458 #[inline(always)]
459 fn into(self) -> PathBuf {
460 self.path
461 }
462}
463
464impl Into<OsString> for PathDSL {
465 #[inline(always)]
466 fn into(self) -> OsString {
467 self.into_os_string()
468 }
469}
470
471impl Into<Box<Path>> for PathDSL {
472 #[inline(always)]
473 fn into(self) -> Box<Path> {
474 self.into_boxed_path()
475 }
476}
477
478impl<'a> Into<Cow<'a, Path>> for PathDSL {
479 #[inline(always)]
480 fn into(self) -> Cow<'a, Path> {
481 self.path.into()
482 }
483}
484
485impl<'a> Into<Cow<'a, Path>> for &'a PathDSL {
486 #[inline(always)]
487 fn into(self) -> Cow<'a, Path> {
488 Cow::Borrowed(self.path.as_path())
489 }
490}
491
492impl<'a> Into<Cow<'a, OsStr>> for &'a PathDSL {
493 #[inline(always)]
494 fn into(self) -> Cow<'a, OsStr> {
495 Cow::Borrowed(self.path.as_os_str())
496 }
497}
498
499impl<'a> Into<Arc<Path>> for PathDSL {
500 #[inline(always)]
501 fn into(self) -> Arc<Path> {
502 self.path.into()
503 }
504}
505
506impl<'a> Into<Rc<Path>> for PathDSL {
507 #[inline(always)]
508 fn into(self) -> Rc<Path> {
509 self.path.into()
510 }
511}
512
513impl PartialEq<PathDSL> for PathDSL {
518 #[inline(always)]
519 fn eq(&self, other: &PathDSL) -> bool {
520 self.path == other.path
521 }
522}
523
524impl PartialEq<PathBuf> for PathDSL {
525 #[inline(always)]
526 fn eq(&self, other: &PathBuf) -> bool {
527 self.path == *other
528 }
529}
530
531impl PartialEq<Path> for PathDSL {
532 #[inline(always)]
533 fn eq(&self, other: &Path) -> bool {
534 self.path.as_path() == other
535 }
536}
537
538impl PartialEq<OsStr> for PathDSL {
539 #[inline(always)]
540 fn eq(&self, other: &OsStr) -> bool {
541 self.path.as_path() == other
542 }
543}
544
545impl PartialEq<OsString> for PathDSL {
546 #[inline(always)]
547 fn eq(&self, other: &OsString) -> bool {
548 self.path.as_path() == other
549 }
550}
551
552impl<'a> PartialEq<Cow<'a, Path>> for PathDSL {
553 #[inline(always)]
554 fn eq(&self, other: &Cow<'a, Path>) -> bool {
555 self.path.as_path() == other
556 }
557}
558
559impl<'a> PartialEq<Cow<'a, OsStr>> for PathDSL {
560 #[inline(always)]
561 fn eq(&self, other: &Cow<'a, OsStr>) -> bool {
562 self.path.as_path() == other
563 }
564}
565
566impl Eq for PathDSL {}
571
572impl PartialOrd<PathDSL> for PathDSL {
577 #[inline(always)]
578 fn partial_cmp(&self, other: &PathDSL) -> Option<Ordering> {
579 self.path.partial_cmp(&other.path)
580 }
581}
582
583impl PartialOrd<PathBuf> for PathDSL {
584 #[inline(always)]
585 fn partial_cmp(&self, other: &PathBuf) -> Option<Ordering> {
586 self.path.partial_cmp(other)
587 }
588}
589
590impl PartialOrd<Path> for PathDSL {
591 #[inline(always)]
592 fn partial_cmp(&self, other: &Path) -> Option<Ordering> {
593 self.path.as_path().partial_cmp(other)
594 }
595}
596
597impl<'a> PartialOrd<Cow<'a, Path>> for PathDSL {
598 #[inline(always)]
599 fn partial_cmp(&self, other: &Cow<'a, Path>) -> Option<Ordering> {
600 self.path.as_path().partial_cmp(other)
601 }
602}
603
604impl<'a> PartialOrd<Cow<'a, OsStr>> for PathDSL {
605 #[inline(always)]
607 fn partial_cmp(&self, other: &Cow<'a, OsStr>) -> Option<Ordering> {
608 self.path.as_path().partial_cmp(&*other)
609 }
610}
611
612impl PartialOrd<OsStr> for PathDSL {
613 #[inline(always)]
615 fn partial_cmp(&self, other: &OsStr) -> Option<Ordering> {
616 self.path.as_path().partial_cmp(&*other)
617 }
618}
619
620impl PartialOrd<OsString> for PathDSL {
621 #[inline(always)]
623 fn partial_cmp(&self, other: &OsString) -> Option<Ordering> {
624 self.path.as_path().partial_cmp(&*other)
625 }
626}
627
628impl Ord for PathDSL {
633 #[inline(always)]
634 fn cmp(&self, other: &Self) -> Ordering {
635 self.path.cmp(&other.path)
636 }
637}
638
639impl FromStr for PathDSL {
644 type Err = Infallible;
645
646 #[inline(always)]
647 fn from_str(s: &str) -> Result<Self, Self::Err> {
648 PathBuf::from_str(s).map(|path| PathDSL { path })
649 }
650}
651
652impl Hash for PathDSL {
657 #[inline(always)]
658 fn hash<H: Hasher>(&self, state: &mut H) {
659 self.path.hash(state)
660 }
661}
662
663impl<P> Extend<P> for PathDSL
668where
669 P: AsRef<Path>,
670{
671 #[inline(always)]
672 fn extend<I: IntoIterator<Item = P>>(&mut self, iter: I) {
673 self.path.extend(iter)
674 }
675}
676
677impl<'a> IntoIterator for &'a PathDSL {
682 type Item = &'a OsStr;
683 type IntoIter = Iter<'a>;
684
685 #[inline(always)]
686 fn into_iter(self) -> Self::IntoIter {
687 self.path.as_path().iter()
688 }
689}
690
691impl Borrow<Path> for PathDSL {
696 #[inline(always)]
697 fn borrow(&self) -> &Path {
698 self.path.borrow()
699 }
700}
701
702impl Div<PathDSL> for PathDSL {
707 type Output = PathDSL;
708
709 #[inline(always)]
710 fn div(mut self, rhs: PathDSL) -> Self::Output {
711 if self.path.as_os_str().is_empty() {
712 rhs
713 } else {
714 self.path.push(rhs);
715 self
716 }
717 }
718}
719
720impl<T> Div<&T> for PathDSL
721where
722 T: AsRef<Path> + ?Sized,
723{
724 type Output = PathDSL;
725
726 #[inline(always)]
727 fn div(mut self, rhs: &T) -> Self::Output {
728 self.path.push(rhs.as_ref());
729 self
730 }
731}
732
733impl<T> Div<&mut T> for PathDSL
734where
735 T: AsRef<Path> + ?Sized,
736{
737 type Output = PathDSL;
738
739 #[inline(always)]
740 fn div(mut self, rhs: &mut T) -> Self::Output {
741 self.path.push(rhs.as_ref());
742 self
743 }
744}
745
746impl Div<OsString> for PathDSL {
747 type Output = PathDSL;
748
749 #[inline(always)]
750 fn div(mut self, rhs: OsString) -> Self::Output {
751 if self.path.as_os_str().is_empty() {
752 Self::from(rhs)
753 } else {
754 self.path.push(rhs);
755 self
756 }
757 }
758}
759
760impl Div<String> for PathDSL {
761 type Output = PathDSL;
762
763 #[inline(always)]
764 fn div(mut self, rhs: String) -> Self::Output {
765 if self.path.as_os_str().is_empty() {
766 Self::from(rhs)
767 } else {
768 self.path.push(rhs);
769 self
770 }
771 }
772}
773
774impl Div<PathBuf> for PathDSL {
775 type Output = PathDSL;
776
777 #[inline(always)]
778 fn div(mut self, rhs: PathBuf) -> Self::Output {
779 if self.path.as_os_str().is_empty() {
780 Self::from(rhs)
781 } else {
782 self.path.push(rhs);
783 self
784 }
785 }
786}
787
788impl Div<Box<Path>> for PathDSL {
789 type Output = PathDSL;
790
791 #[inline(always)]
792 fn div(mut self, rhs: Box<Path>) -> Self::Output {
793 self.path.push(rhs);
794 self
795 }
796}
797
798impl Div<Cow<'_, Path>> for PathDSL {
799 type Output = PathDSL;
800
801 #[inline(always)]
802 fn div(mut self, rhs: Cow<'_, Path>) -> Self::Output {
803 self.path.push(rhs);
804 self
805 }
806}
807
808impl Div<Cow<'_, OsStr>> for PathDSL {
809 type Output = PathDSL;
810
811 #[inline(always)]
812 fn div(mut self, rhs: Cow<'_, OsStr>) -> Self::Output {
813 self.path.push(rhs);
814 self
815 }
816}
817
818impl Div<PathDSL> for &PathDSL {
823 type Output = PathDSL;
824
825 #[inline(always)]
826 fn div(self, rhs: PathDSL) -> Self::Output {
827 let mut new_self = (*self).clone();
828 new_self.path.push(rhs);
829 new_self
830 }
831}
832
833impl<T> Div<&T> for &PathDSL
834where
835 T: AsRef<Path> + ?Sized,
836{
837 type Output = PathDSL;
838
839 #[inline(always)]
840 fn div(self, rhs: &T) -> Self::Output {
841 let mut new_self = (*self).clone();
842 new_self.path.push(rhs.as_ref());
843 new_self
844 }
845}
846
847impl<T> Div<&mut T> for &PathDSL
848where
849 T: AsRef<Path> + ?Sized,
850{
851 type Output = PathDSL;
852
853 #[inline(always)]
854 fn div(self, rhs: &mut T) -> Self::Output {
855 let mut new_self = (*self).clone();
856 new_self.path.push(rhs.as_ref());
857 new_self
858 }
859}
860
861impl Div<OsString> for &PathDSL {
862 type Output = PathDSL;
863
864 #[inline(always)]
865 fn div(self, rhs: OsString) -> Self::Output {
866 let mut new_self = (*self).clone();
867 new_self.path.push(rhs);
868 new_self
869 }
870}
871
872impl Div<String> for &PathDSL {
873 type Output = PathDSL;
874
875 #[inline(always)]
876 fn div(self, rhs: String) -> Self::Output {
877 let mut new_self = (*self).clone();
878 new_self.path.push(rhs);
879 new_self
880 }
881}
882
883impl Div<PathBuf> for &PathDSL {
884 type Output = PathDSL;
885
886 #[inline(always)]
887 fn div(self, rhs: PathBuf) -> Self::Output {
888 let mut new_self = (*self).clone();
889 new_self.path.push(rhs);
890 new_self
891 }
892}
893
894impl Div<Box<Path>> for &PathDSL {
895 type Output = PathDSL;
896
897 #[inline(always)]
898 fn div(self, rhs: Box<Path>) -> Self::Output {
899 let mut new_self = (*self).clone();
900 new_self.path.push(rhs);
901 new_self
902 }
903}
904
905impl Div<Cow<'_, Path>> for &PathDSL {
906 type Output = PathDSL;
907
908 #[inline(always)]
909 fn div(self, rhs: Cow<'_, Path>) -> Self::Output {
910 let mut new_self = (*self).clone();
911 new_self.path.push(rhs);
912 new_self
913 }
914}
915
916impl Div<Cow<'_, OsStr>> for &PathDSL {
917 type Output = PathDSL;
918
919 #[inline(always)]
920 fn div(self, rhs: Cow<'_, OsStr>) -> Self::Output {
921 let mut new_self = (*self).clone();
922 new_self.path.push(rhs);
923 new_self
924 }
925}
926
927impl Div<PathDSL> for &mut PathDSL {
932 type Output = PathDSL;
933
934 #[inline(always)]
935 fn div(self, rhs: PathDSL) -> Self::Output {
936 let mut new_self = (*self).clone();
937 new_self.path.push(rhs);
938 new_self
939 }
940}
941
942impl<T> Div<&T> for &mut PathDSL
943where
944 T: AsRef<Path> + ?Sized,
945{
946 type Output = PathDSL;
947
948 #[inline(always)]
949 fn div(self, rhs: &T) -> Self::Output {
950 let mut new_self = (*self).clone();
951 new_self.path.push(rhs.as_ref());
952 new_self
953 }
954}
955
956impl<T> Div<&mut T> for &mut PathDSL
957where
958 T: AsRef<Path> + ?Sized,
959{
960 type Output = PathDSL;
961
962 #[inline(always)]
963 fn div(self, rhs: &mut T) -> Self::Output {
964 let mut new_self = (*self).clone();
965 new_self.path.push(rhs.as_ref());
966 new_self
967 }
968}
969
970impl Div<OsString> for &mut PathDSL {
971 type Output = PathDSL;
972
973 #[inline(always)]
974 fn div(self, rhs: OsString) -> Self::Output {
975 let mut new_self = (*self).clone();
976 new_self.path.push(rhs);
977 new_self
978 }
979}
980
981impl Div<String> for &mut PathDSL {
982 type Output = PathDSL;
983
984 #[inline(always)]
985 fn div(self, rhs: String) -> Self::Output {
986 let mut new_self = (*self).clone();
987 new_self.path.push(rhs);
988 new_self
989 }
990}
991
992impl Div<PathBuf> for &mut PathDSL {
993 type Output = PathDSL;
994
995 #[inline(always)]
996 fn div(self, rhs: PathBuf) -> Self::Output {
997 let mut new_self = (*self).clone();
998 new_self.path.push(rhs);
999 new_self
1000 }
1001}
1002
1003impl Div<Box<Path>> for &mut PathDSL {
1004 type Output = PathDSL;
1005
1006 #[inline(always)]
1007 fn div(self, rhs: Box<Path>) -> Self::Output {
1008 let mut new_self = (*self).clone();
1009 new_self.path.push(rhs);
1010 new_self
1011 }
1012}
1013
1014impl Div<Cow<'_, Path>> for &mut PathDSL {
1015 type Output = PathDSL;
1016
1017 #[inline(always)]
1018 fn div(self, rhs: Cow<'_, Path>) -> Self::Output {
1019 let mut new_self = (*self).clone();
1020 new_self.path.push(rhs);
1021 new_self
1022 }
1023}
1024
1025impl Div<Cow<'_, OsStr>> for &mut PathDSL {
1026 type Output = PathDSL;
1027
1028 #[inline(always)]
1029 fn div(self, rhs: Cow<'_, OsStr>) -> Self::Output {
1030 let mut new_self = (*self).clone();
1031 new_self.path.push(rhs);
1032 new_self
1033 }
1034}
1035
1036#[derive(Default)]
1043#[doc(hidden)]
1044pub struct CopylessDSL;
1045
1046impl CopylessDSL {
1047 #[doc(hidden)]
1049 #[inline(always)]
1050 pub fn new() -> CopylessDSL {
1051 CopylessDSL
1052 }
1053}
1054
1055impl Into<PathDSL> for CopylessDSL {
1056 #[inline(always)]
1057 fn into(self) -> PathDSL {
1058 PathDSL::new()
1059 }
1060}
1061
1062impl Into<PathBuf> for CopylessDSL {
1063 #[inline(always)]
1064 fn into(self) -> PathBuf {
1065 PathBuf::new()
1066 }
1067}
1068
1069impl Div<PathDSL> for CopylessDSL {
1070 type Output = PathDSL;
1071
1072 #[inline(always)]
1073 fn div(self, rhs: PathDSL) -> Self::Output {
1074 rhs
1075 }
1076}
1077
1078impl<T> Div<&T> for CopylessDSL
1079where
1080 T: AsRef<Path> + ?Sized,
1081{
1082 type Output = PathDSL;
1083
1084 #[inline(always)]
1085 fn div(self, rhs: &T) -> Self::Output {
1086 PathDSL::from(rhs)
1087 }
1088}
1089
1090impl<T> Div<&mut T> for CopylessDSL
1091where
1092 T: AsRef<Path> + ?Sized,
1093{
1094 type Output = PathDSL;
1095
1096 #[inline(always)]
1097 fn div(self, rhs: &mut T) -> Self::Output {
1098 PathDSL::from(rhs)
1099 }
1100}
1101
1102impl Div<OsString> for CopylessDSL {
1103 type Output = PathDSL;
1104
1105 #[inline(always)]
1106 fn div(self, rhs: OsString) -> Self::Output {
1107 PathDSL::from(rhs)
1108 }
1109}
1110
1111impl Div<String> for CopylessDSL {
1112 type Output = PathDSL;
1113
1114 #[inline(always)]
1115 fn div(self, rhs: String) -> Self::Output {
1116 PathDSL::from(rhs)
1117 }
1118}
1119
1120impl Div<PathBuf> for CopylessDSL {
1121 type Output = PathDSL;
1122
1123 #[inline(always)]
1124 fn div(self, rhs: PathBuf) -> Self::Output {
1125 PathDSL::from(rhs)
1126 }
1127}
1128
1129impl Div<Box<Path>> for CopylessDSL {
1130 type Output = PathDSL;
1131
1132 #[inline(always)]
1133 fn div(self, rhs: Box<Path>) -> Self::Output {
1134 PathDSL::from(rhs)
1135 }
1136}
1137
1138impl Div<Cow<'_, Path>> for CopylessDSL {
1139 type Output = PathDSL;
1140
1141 #[inline(always)]
1142 fn div(self, rhs: Cow<'_, Path>) -> Self::Output {
1143 PathDSL::from(rhs)
1144 }
1145}
1146
1147impl Div<Cow<'_, OsStr>> for CopylessDSL {
1148 type Output = PathDSL;
1149
1150 #[inline(always)]
1151 fn div(self, rhs: Cow<'_, OsStr>) -> Self::Output {
1152 PathDSL::from(&*rhs)
1153 }
1154}
1155
1156#[cfg(windows)]
1157#[doc(hidden)]
1158#[macro_export]
1159macro_rules! separator {
1160 () => {
1161 "\\"
1162 };
1163}
1164
1165#[cfg(not(windows))]
1166#[doc(hidden)]
1167#[macro_export]
1168macro_rules! separator {
1169 () => {
1170 "/"
1171 };
1172}
1173
1174#[doc(hidden)]
1175#[macro_export]
1176macro_rules! concat_separator {
1177 ( $e:literal, $($other:literal),+ ) => {
1178 concat!($e, $crate::separator!(), $crate::concat_separator!($($other),+))
1179 };
1180 ( $e:literal ) => {
1181 $e
1182 }
1183}
1184
1185#[doc(hidden)]
1186#[macro_export]
1187macro_rules! path_impl {
1188 ( @($($stack:expr),*)@ ($exp:expr) | $($other:tt)+ ) => {
1189 $crate::path_impl!( @($($stack),* / $exp)@ $($other)+ )
1190 };
1191 ( @($($stack:expr),*)@ ($exp:expr) ) => {
1192 $($stack),* / $exp
1193 };
1194 ( @($($stack:expr),*)@ $blk:block | $($other:tt)+ ) => {
1195 $crate::path_impl!( @($($stack),* / $blk)@ $($other)+ )
1196 };
1197 ( @($($stack:expr),*)@ $blk:block ) => {
1198 $($stack),* / $blk
1199 };
1200 ( @($($stack:expr),*)@ $name:path | $($other:tt)+ ) => {
1201 $crate::path_impl!( @($($stack),* / $name)@ $($other)+ )
1202 };
1203 ( @($($stack:expr),*)@ $name:path ) => {
1204 $($stack),* / $name
1205 };
1206 ( @($($stack:expr),*)@ &$name:path | $($other:tt)+ ) => {
1207 $crate::path_impl!( @($($stack),* / &$name)@ $($other)+ )
1208 };
1209 ( @($($stack:expr),*)@ &$name:path ) => {
1210 $($stack),* / &$name
1211 };
1212 ( @($($stack:expr),*)@ &mut $name:path | $($other:tt)+ ) => {
1213 $crate::path_impl!( @($($stack),* / &mut $name)@ $($other)+ )
1214 };
1215 ( @($($stack:expr),*)@ &mut $name:path ) => {
1216 $($stack),* / &mut $name
1217 };
1218 ( @($($stack:expr),*)@ $lit:literal | $lit2:literal | $lit3:literal | $lit4:literal | $lit5:literal | $lit6:literal | $lit7:literal | $lit8:literal | $lit9:literal | $lit10:literal | $lit11:literal | $lit12:literal | $lit13:literal | $lit14:literal | $lit15:literal | $lit16:literal | $($other:tt)+ ) => {
1219 $crate::path_impl!( @($($stack),* / $crate::concat_separator!($lit, $lit2, $lit3, $lit4, $lit5, $lit6, $lit7, $lit8, $lit9, $lit10, $lit11, $lit12, $lit13, $lit14, $lit15, $lit16))@ $($other)+ )
1220 };
1221 ( @($($stack:expr),*)@ $lit:literal | $lit2:literal | $lit3:literal | $lit4:literal | $lit5:literal | $lit6:literal | $lit7:literal | $lit8:literal | $lit9:literal | $lit10:literal | $lit11:literal | $lit12:literal | $lit13:literal | $lit14:literal | $lit15:literal | $($other:tt)+ ) => {
1222 $crate::path_impl!( @($($stack),* / $crate::concat_separator!($lit, $lit2, $lit3, $lit4, $lit5, $lit6, $lit7, $lit8, $lit9, $lit10, $lit11, $lit12, $lit13, $lit14, $lit15))@ $($other)+ )
1223 };
1224 ( @($($stack:expr),*)@ $lit:literal | $lit2:literal | $lit3:literal | $lit4:literal | $lit5:literal | $lit6:literal | $lit7:literal | $lit8:literal | $lit9:literal | $lit10:literal | $lit11:literal | $lit12:literal | $lit13:literal | $lit14:literal | $($other:tt)+ ) => {
1225 $crate::path_impl!( @($($stack),* / $crate::concat_separator!($lit, $lit2, $lit3, $lit4, $lit5, $lit6, $lit7, $lit8, $lit9, $lit10, $lit11, $lit12, $lit13, $lit14))@ $($other)+ )
1226 };
1227 ( @($($stack:expr),*)@ $lit:literal | $lit2:literal | $lit3:literal | $lit4:literal | $lit5:literal | $lit6:literal | $lit7:literal | $lit8:literal | $lit9:literal | $lit10:literal | $lit11:literal | $lit12:literal | $lit13:literal | $($other:tt)+ ) => {
1228 $crate::path_impl!( @($($stack),* / $crate::concat_separator!($lit, $lit2, $lit3, $lit4, $lit5, $lit6, $lit7, $lit8, $lit9, $lit10, $lit11, $lit12, $lit13))@ $($other)+ )
1229 };
1230 ( @($($stack:expr),*)@ $lit:literal | $lit2:literal | $lit3:literal | $lit4:literal | $lit5:literal | $lit6:literal | $lit7:literal | $lit8:literal | $lit9:literal | $lit10:literal | $lit11:literal | $lit12:literal | $($other:tt)+ ) => {
1231 $crate::path_impl!( @($($stack),* / $crate::concat_separator!($lit, $lit2, $lit3, $lit4, $lit5, $lit6, $lit7, $lit8, $lit9, $lit10, $lit11, $lit12))@ $($other)+ )
1232 };
1233 ( @($($stack:expr),*)@ $lit:literal | $lit2:literal | $lit3:literal | $lit4:literal | $lit5:literal | $lit6:literal | $lit7:literal | $lit8:literal | $lit9:literal | $lit10:literal | $lit11:literal | $($other:tt)+ ) => {
1234 $crate::path_impl!( @($($stack),* / $crate::concat_separator!($lit, $lit2, $lit3, $lit4, $lit5, $lit6, $lit7, $lit8, $lit9, $lit10, $lit11))@ $($other)+ )
1235 };
1236 ( @($($stack:expr),*)@ $lit:literal | $lit2:literal | $lit3:literal | $lit4:literal | $lit5:literal | $lit6:literal | $lit7:literal | $lit8:literal | $lit9:literal | $lit10:literal | $($other:tt)+ ) => {
1237 $crate::path_impl!( @($($stack),* / $crate::concat_separator!($lit, $lit2, $lit3, $lit4, $lit5, $lit6, $lit7, $lit8, $lit9, $lit10))@ $($other)+ )
1238 };
1239 ( @($($stack:expr),*)@ $lit:literal | $lit2:literal | $lit3:literal | $lit4:literal | $lit5:literal | $lit6:literal | $lit7:literal | $lit8:literal | $lit9:literal| $($other:tt)+ ) => {
1240 $crate::path_impl!( @($($stack),* / $crate::concat_separator!($lit, $lit2, $lit3, $lit4, $lit5, $lit6, $lit7, $lit8, $lit9))@ $($other)+ )
1241 };
1242 ( @($($stack:expr),*)@ $lit:literal | $lit2:literal | $lit3:literal | $lit4:literal | $lit5:literal | $lit6:literal | $lit7:literal | $lit8:literal | $($other:tt)+ ) => {
1243 $crate::path_impl!( @($($stack),* / $crate::concat_separator!($lit, $lit2, $lit3, $lit4, $lit5, $lit6, $lit7, $lit8))@ $($other)+ )
1244 };
1245 ( @($($stack:expr),*)@ $lit:literal | $lit2:literal | $lit3:literal | $lit4:literal | $lit5:literal | $lit6:literal | $lit7:literal | $($other:tt)+ ) => {
1246 $crate::path_impl!( @($($stack),* / $crate::concat_separator!($lit, $lit2, $lit3, $lit4, $lit5, $lit6, $lit7))@ $($other)+ )
1247 };
1248 ( @($($stack:expr),*)@ $lit:literal | $lit2:literal | $lit3:literal | $lit4:literal | $lit5:literal | $lit6:literal | $($other:tt)+ ) => {
1249 $crate::path_impl!( @($($stack),* / $crate::concat_separator!($lit, $lit2, $lit3, $lit4, $lit5, $lit6))@ $($other)+ )
1250 };
1251 ( @($($stack:expr),*)@ $lit:literal | $lit2:literal | $lit3:literal | $lit4:literal | $lit5:literal | $($other:tt)+ ) => {
1252 $crate::path_impl!( @($($stack),* / $crate::concat_separator!($lit, $lit2, $lit3, $lit4, $lit5))@ $($other)+ )
1253 };
1254 ( @($($stack:expr),*)@ $lit:literal | $lit2:literal | $lit3:literal | $lit4:literal | $($other:tt)+ ) => {
1255 $crate::path_impl!( @($($stack),* / $crate::concat_separator!($lit, $lit2, $lit3, $lit4))@ $($other)+ )
1256 };
1257 ( @($($stack:expr),*)@ $lit:literal | $lit2:literal | $lit3:literal | $($other:tt)+ ) => {
1258 $crate::path_impl!( @($($stack),* / $crate::concat_separator!($lit, $lit2, $lit3))@ $($other)+ )
1259 };
1260 ( @($($stack:expr),*)@ $lit:literal | $lit2:literal | $($other:tt)+ ) => {
1261 $crate::path_impl!( @($($stack),* / $crate::concat_separator!($lit, $lit2))@ $($other)+ )
1262 };
1263 ( @($($stack:expr),*)@ $lit:literal | $($other:tt)+ ) => {
1264 $crate::path_impl!( @($($stack),* / $lit)@ $($other)+ )
1265 };
1266 ( @($($stack:expr),*)@ $lit:literal ) => {
1267 $($stack),* / $lit
1268 };
1269 ( @($($stack:expr),*)@ ) => {
1270 $($stack),*
1271 };
1272}
1273
1274#[macro_export]
1371macro_rules! path {
1372 ( $($other:tt)* ) => {
1373 ::std::convert::Into::<std::path::PathBuf>::into($crate::path_impl!( @($crate::CopylessDSL::new())@ $($other)* ));
1374 };
1375 () => { $crate::PathDSL::new() };
1376}