#[non_exhaustive]pub enum CreatableFormat {
Tar,
TarGz,
TarBz2,
TarXz,
TarZst,
Zip,
}Expand description
Archive formats exarch can create.
The subset of ArchiveType with a writer: 7z can be read but not
created, so it is absent here and a creation API cannot be asked for it.
§Examples
use exarch_core::formats::detect::ArchiveType;
use exarch_core::formats::detect::CreatableFormat;
assert_eq!(ArchiveType::from(CreatableFormat::TarGz), ArchiveType::TarGz);
assert_eq!(
CreatableFormat::try_from(ArchiveType::Zip).unwrap(),
CreatableFormat::Zip
);
assert!(CreatableFormat::try_from(ArchiveType::SevenZ).is_err());Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Tar
Tar archive (uncompressed).
TarGz
Gzip-compressed tar archive.
TarBz2
Bzip2-compressed tar archive.
TarXz
XZ-compressed tar archive.
TarZst
Zstd-compressed tar archive.
Zip
ZIP archive.
Implementations§
Trait Implementations§
Source§impl Clone for CreatableFormat
impl Clone for CreatableFormat
Source§impl ClosedEnum for CreatableFormat
impl ClosedEnum for CreatableFormat
impl Copy for CreatableFormat
Source§impl Debug for CreatableFormat
impl Debug for CreatableFormat
Source§impl Display for CreatableFormat
impl Display for CreatableFormat
impl Eq for CreatableFormat
Source§impl From<CreatableFormat> for ArchiveType
impl From<CreatableFormat> for ArchiveType
Source§fn from(format: CreatableFormat) -> Self
fn from(format: CreatableFormat) -> Self
Converts to this type from the input type.
Source§impl FromStr for CreatableFormat
impl FromStr for CreatableFormat
Source§fn from_str(value: &str) -> Result<Self>
fn from_str(value: &str) -> Result<Self>
Parses the string form shared with ArchiveType::as_str.
§Errors
ArchiveError::InvalidConfiguration naming
ConfigSetting::CreationFormat: ConfigProblem::NotCreatable for
the spelling of a format that can only be read, and
ConfigProblem::NotOneOf listing the creatable formats for any other
string.
§Examples
use exarch_core::formats::detect::CreatableFormat;
assert_eq!(
"Zip".parse::<CreatableFormat>().unwrap(),
CreatableFormat::Zip
);
let err = "SevenZ".parse::<CreatableFormat>().unwrap_err();
assert_eq!(
err.to_string(),
"invalid configuration: 7z archive creation is not supported"
);Source§type Err = ArchiveError
type Err = ArchiveError
The associated error which can be returned from parsing.
Source§impl PartialEq for CreatableFormat
impl PartialEq for CreatableFormat
impl StructuralPartialEq for CreatableFormat
Source§impl TryFrom<ArchiveType> for CreatableFormat
impl TryFrom<ArchiveType> for CreatableFormat
Source§fn try_from(format: ArchiveType) -> Result<Self>
fn try_from(format: ArchiveType) -> Result<Self>
§Errors
Returns ArchiveError::InvalidConfiguration with
ConfigProblem::NotCreatable for 7z, which cannot be created.
Source§type Error = ArchiveError
type Error = ArchiveError
The type returned in the event of a conversion error.
Auto Trait Implementations§
impl Freeze for CreatableFormat
impl RefUnwindSafe for CreatableFormat
impl Send for CreatableFormat
impl Sync for CreatableFormat
impl Unpin for CreatableFormat
impl UnsafeUnpin for CreatableFormat
impl UnwindSafe for CreatableFormat
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.