Skip to main content

CreatableFormat

Enum CreatableFormat 

Source
#[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§

Source§

impl CreatableFormat

Source

pub const ALL: &'static [Self]

Every variant, in declaration order.

Source

pub const NAMES: &'static [&'static str]

The string form of every variant, in declaration order.

Source

pub const fn as_str(self) -> &'static str

Returns the stable string form shared by Display and all language bindings.

Trait Implementations§

Source§

impl Clone for CreatableFormat

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl ClosedEnum for CreatableFormat

Source§

const ALL: &'static [Self] = Self::ALL

Every variant, in declaration order.
Source§

const NAMES: &'static [&'static str] = Self::NAMES

The string form of every variant, in declaration order.
Source§

fn as_str(self) -> &'static str

The stable string form of this variant.
Source§

fn parse_for(setting: ConfigSetting, value: &str) -> Result<Self>

Parses the string form of a variant. Read more
Source§

impl Copy for CreatableFormat

Source§

impl Debug for CreatableFormat

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for CreatableFormat

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for CreatableFormat

Source§

impl From<CreatableFormat> for ArchiveType

Source§

fn from(format: CreatableFormat) -> Self

Converts to this type from the input type.
Source§

impl FromStr for CreatableFormat

Source§

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

The associated error which can be returned from parsing.
Source§

impl PartialEq for CreatableFormat

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for CreatableFormat

Source§

impl TryFrom<ArchiveType> for CreatableFormat

Source§

fn try_from(format: ArchiveType) -> Result<Self>

§Errors

Returns ArchiveError::InvalidConfiguration with ConfigProblem::NotCreatable for 7z, which cannot be created.

Source§

type Error = ArchiveError

The type returned in the event of a conversion error.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.