| 1 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/::FromStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr#; |
| 2 | |
| 3 | use craterust-analyzer cargo bottom 0.14.9 crate/::multi_eq_ignore_ascii_caserust-analyzer cargo bottom 0.14.9 utils/strings/multi_eq_ignore_ascii_case!; |
| 4 | |
| 5 | /// Known filesystems. Original list from |
| 6 | /// [heim](https://github.com/heim-rs/heim/blob/master/heim-disk/src/filesystem.rs). |
| 7 | /// |
| 8 | /// All physical filesystems should have their own enum element and all virtual |
| 9 | /// filesystems will go into the [`FileSystem::Other`] element. |
| 10 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/macros/Hash:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)] |
| 11 | #[non_exhaustive] |
| 12 | pub enum FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem# { |
| 13 | /// ext2 (<https://en.wikipedia.org/wiki/Ext2>) |
| 14 | Ext2rust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Ext2#, |
| 15 | |
| 16 | /// ext3 (<https://en.wikipedia.org/wiki/Ext3>) |
| 17 | Ext3rust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Ext3#, |
| 18 | |
| 19 | /// ext4 (<https://en.wikipedia.org/wiki/Ext4>) |
| 20 | Ext4rust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Ext4#, |
| 21 | |
| 22 | /// FAT (<https://en.wikipedia.org/wiki/File_Allocation_Table>) |
| 23 | VFatrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#VFat#, |
| 24 | |
| 25 | /// exFAT (<https://en.wikipedia.org/wiki/ExFAT>) |
| 26 | ExFatrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#ExFat#, |
| 27 | |
| 28 | /// F2FS (<https://en.wikipedia.org/wiki/F2FS>) |
| 29 | F2fsrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#F2fs#, |
| 30 | |
| 31 | /// NTFS (<https://en.wikipedia.org/wiki/NTFS>) |
| 32 | Ntfsrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Ntfs#, |
| 33 | |
| 34 | /// ZFS (<https://en.wikipedia.org/wiki/ZFS>) |
| 35 | Zfsrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Zfs#, |
| 36 | |
| 37 | /// HFS (<https://en.wikipedia.org/wiki/Hierarchical_File_System>) |
| 38 | Hfsrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Hfs#, |
| 39 | |
| 40 | /// HFS+ (<https://en.wikipedia.org/wiki/HFS_Plus>) |
| 41 | HfsPlusrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#HfsPlus#, |
| 42 | |
| 43 | /// JFS (<https://en.wikipedia.org/wiki/JFS_(file_system)>) |
| 44 | Jfsrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Jfs#, |
| 45 | |
| 46 | /// ReiserFS 3 (<https://en.wikipedia.org/wiki/ReiserFS>) |
| 47 | Reiser3rust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Reiser3#, |
| 48 | |
| 49 | /// ReiserFS 4 (<https://en.wikipedia.org/wiki/Reiser4>) |
| 50 | Reiser4rust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Reiser4#, |
| 51 | |
| 52 | /// Btrfs (<https://en.wikipedia.org/wiki/Btrfs>) |
| 53 | Btrfsrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Btrfs#, |
| 54 | |
| 55 | /// Bcachefs (<https://en.wikipedia.org/wiki/Bcachefs>) |
| 56 | Bcachefsrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Bcachefs#, |
| 57 | |
| 58 | /// MINIX FS (<https://en.wikipedia.org/wiki/MINIX_file_system>) |
| 59 | Minixrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Minix#, |
| 60 | |
| 61 | /// NILFS (<https://en.wikipedia.org/wiki/NILFS>) |
| 62 | Nilfsrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Nilfs#, |
| 63 | |
| 64 | /// XFS (<https://en.wikipedia.org/wiki/XFS>) |
| 65 | Xfsrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Xfs#, |
| 66 | |
| 67 | /// APFS (<https://en.wikipedia.org/wiki/Apple_File_System>) |
| 68 | Apfsrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Apfs#, |
| 69 | |
| 70 | /// FUSE (<https://en.wikipedia.org/wiki/Filesystem_in_Userspace>) |
| 71 | FuseBlkrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#FuseBlk#, |
| 72 | |
| 73 | /// Some unspecified filesystem. |
| 74 | Otherrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Other#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#), |
| 75 | } |
| 76 | |
| 77 | impl FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem# { |
| 78 | /// Checks if filesystem is used for a physical devices. |
| 79 | #[inline] |
| 80 | pub fn is_physicalrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/impl#[FileSystem]is_physical().(&self) -> bool { |
| 81 | !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.is_virtualrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/impl#[FileSystem]is_virtual().() |
| 82 | } |
| 83 | |
| 84 | /// Checks if filesystem is used for a virtual devices (such as `tmpfs` or |
| 85 | /// `smb` mounts). |
| 86 | #[inline] |
| 87 | pub fn is_virtualrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/impl#[FileSystem]is_virtual().(&self) -> bool { |
| 88 | matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(self, FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::Otherrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Other#(..)) |
| 89 | } |
| 90 | |
| 91 | #[expect(dead_code)] |
| 92 | #[inline] |
| 93 | /// Returns a string literal identifying this filesystem. |
| 94 | pub fn as_strrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/impl#[FileSystem]as_str().(&self) -> &str { |
| 95 | match self { |
| 96 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::Ext2rust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Ext2# => "ext2", |
| 97 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::Ext3rust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Ext3# => "ext3", |
| 98 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::Ext4rust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Ext4# => "ext4", |
| 99 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::VFatrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#VFat# => "vfat", |
| 100 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::Ntfsrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Ntfs# => "ntfs", |
| 101 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::Zfsrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Zfs# => "zfs", |
| 102 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::Hfsrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Hfs# => "hfs", |
| 103 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::Reiser3rust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Reiser3# => "reiserfs", |
| 104 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::Reiser4rust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Reiser4# => "reiser4", |
| 105 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::FuseBlkrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#FuseBlk# => "fuseblk", |
| 106 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::ExFatrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#ExFat# => "exfat", |
| 107 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::F2fsrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#F2fs# => "f2fs", |
| 108 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::HfsPlusrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#HfsPlus# => "hfs+", |
| 109 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::Jfsrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Jfs# => "jfs", |
| 110 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::Btrfsrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Btrfs# => "btrfs", |
| 111 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::Bcachefsrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Bcachefs# => "bcachefs", |
| 112 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::Minixrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Minix# => "minix", |
| 113 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::Nilfsrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Nilfs# => "nilfs", |
| 114 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::Xfsrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Xfs# => "xfs", |
| 115 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::Apfsrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Apfs# => "apfs", |
| 116 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::Otherrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Other#(string) => string.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().(), |
| 117 | } |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | impl FromStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr# for FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem# { |
| 122 | type Errrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/impl#[FileSystem][FromStr]Err# = anyhowrust-analyzer cargo anyhow 1.0.104 crate/::Errorrust-analyzer cargo anyhow 1.0.104 Error#; |
| 123 | |
| 124 | #[inline] |
| 125 | fn from_strrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/impl#[FileSystem][FromStr]from_str().(s: &str) -> anyhowrust-analyzer cargo anyhow 1.0.104 crate/::Resultrust-analyzer cargo anyhow 1.0.104 Result#<Selfrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/impl#[FileSystem][FromStr]> { |
| 126 | // Done like this as `eq_ignore_ascii_case` avoids a string allocation. |
| 127 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(if s.eq_ignore_ascii_caserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]eq_ignore_ascii_case().("ext2") { |
| 128 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::Ext2rust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Ext2# |
| 129 | } else if s.eq_ignore_ascii_caserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]eq_ignore_ascii_case().("ext3") { |
| 130 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::Ext3rust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Ext3# |
| 131 | } else if s.eq_ignore_ascii_caserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]eq_ignore_ascii_case().("ext4") { |
| 132 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::Ext4rust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Ext4# |
| 133 | } else if multi_eq_ignore_ascii_caserust-analyzer cargo bottom 0.14.9 utils/strings/multi_eq_ignore_ascii_case!!(s, "msdos" | "vfat") { |
| 134 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::VFatrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#VFat# |
| 135 | } else if multi_eq_ignore_ascii_caserust-analyzer cargo bottom 0.14.9 utils/strings/multi_eq_ignore_ascii_case!!(s, "ntfs3" | "ntfs") { |
| 136 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::Ntfsrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Ntfs# |
| 137 | } else if s.eq_ignore_ascii_caserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]eq_ignore_ascii_case().("zfs") { |
| 138 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::Zfsrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Zfs# |
| 139 | } else if s.eq_ignore_ascii_caserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]eq_ignore_ascii_case().("hfs") { |
| 140 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::Hfsrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Hfs# |
| 141 | } else if s.eq_ignore_ascii_caserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]eq_ignore_ascii_case().("reiserfs") { |
| 142 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::Reiser3rust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Reiser3# |
| 143 | } else if s.eq_ignore_ascii_caserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]eq_ignore_ascii_case().("reiser4") { |
| 144 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::Reiser4rust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Reiser4# |
| 145 | } else if s.eq_ignore_ascii_caserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]eq_ignore_ascii_case().("exfat") { |
| 146 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::ExFatrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#ExFat# |
| 147 | } else if s.eq_ignore_ascii_caserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]eq_ignore_ascii_case().("f2fs") { |
| 148 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::F2fsrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#F2fs# |
| 149 | } else if s.eq_ignore_ascii_caserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]eq_ignore_ascii_case().("hfsplus") { |
| 150 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::HfsPlusrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#HfsPlus# |
| 151 | } else if s.eq_ignore_ascii_caserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]eq_ignore_ascii_case().("jfs") { |
| 152 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::Jfsrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Jfs# |
| 153 | } else if s.eq_ignore_ascii_caserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]eq_ignore_ascii_case().("btrfs") { |
| 154 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::Btrfsrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Btrfs# |
| 155 | } else if s.eq_ignore_ascii_caserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]eq_ignore_ascii_case().("bcachefs") { |
| 156 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::Bcachefsrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Bcachefs# |
| 157 | } else if s.eq_ignore_ascii_caserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]eq_ignore_ascii_case().("minix") { |
| 158 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::Minixrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Minix# |
| 159 | } else if multi_eq_ignore_ascii_caserust-analyzer cargo bottom 0.14.9 utils/strings/multi_eq_ignore_ascii_case!!(s, "nilfs" | "nilfs2") { |
| 160 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::Nilfsrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Nilfs# |
| 161 | } else if s.eq_ignore_ascii_caserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]eq_ignore_ascii_case().("xfs") { |
| 162 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::Xfsrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Xfs# |
| 163 | } else if s.eq_ignore_ascii_caserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]eq_ignore_ascii_case().("apfs") { |
| 164 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::Apfsrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Apfs# |
| 165 | } else if s.eq_ignore_ascii_caserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]eq_ignore_ascii_case().("fuseblk") { |
| 166 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::FuseBlkrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#FuseBlk# |
| 167 | } else { |
| 168 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::Otherrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Other#(s.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()) |
| 169 | }) |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | #[cfg(test)] |
| 174 | mod testrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/test/ { |
| 175 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/::FromStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr#; |
| 176 | |
| 177 | use superrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/::FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#; |
| 178 | |
| 179 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 180 | fn file_system_from_strrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/test/file_system_from_str().() { |
| 181 | // Something supported |
| 182 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::from_strrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/impl#[FileSystem][FromStr]from_str().("ext4").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::Ext4rust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Ext4#); |
| 183 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::from_strrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/impl#[FileSystem][FromStr]from_str().("msdos").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::VFatrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#VFat#); |
| 184 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::from_strrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/impl#[FileSystem][FromStr]from_str().("vfat").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::VFatrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#VFat#); |
| 185 | |
| 186 | // Something unsupported |
| 187 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 188 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::from_strrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/impl#[FileSystem][FromStr]from_str().("this does not exist").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), |
| 189 | FileSystemrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#::Otherrust-analyzer cargo bottom 0.14.9 collection/disks/unix/file_systems/FileSystem#Other#("this does not exist".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().()) |
| 190 | ); |
| 191 | } |
| 192 | } |