pub enum FileFormat {
Show 154 variants AdaptiveMultiRate, AdobeFlashPlayerAudio, AdobeFlashPlayerAudiobook, AdobeFlashPlayerProtectedVideo, AdobeFlashPlayerVideo, AdobeInDesignDocument, AdobePhotoshopDocument, AdvancedAudioCoding, Alz, AndroidBinaryXml, AndroidCompiledResources, Ani, AnimatedPortableNetworkGraphics, ApacheArrowColumnar, AppleDiskImage, AppleIconImage, AppleItunesAudio, AppleItunesAudiobook, AppleItunesProtectedAudio, AppleItunesVideo, AppleQuickTime, ArbitraryBinaryData, ArchivedByRobertJung, Au, AudioCodec3, AudioInterchangeFileFormat, AudioVideoInterleave, Av1ImageFileFormat, Av1ImageFileFormatSequence, BetterPortableGraphics, Blender, Bzip2, Cabinet, CanonRaw2, CanonRaw3, Cineon, CompoundFileBinary, Cpio, Cur, DalvikExecutable, DebianBinaryPackage, DigitalImagingAndCommunicationsInMedicine, DigitalPictureExchange, EmbeddedOpenType, ExecutableAndLinkableFormat, ExperimentalComputingFacility, ExtensibleArchive, FastTracker2ExtendedModule, FlashVideo, FlexibleImageTransportSystem, FreeLosslessAudioCodec, FreeLosslessImageFormat, FujifilmRaw, GameBoyAdvanceRom, GameBoyColorRom, GameBoyRom, GlTransmissionFormatBinary, GoogleChromeExtension, GraphicsInterchangeFormat, Gzip, HighEfficiencyImageCoding, HighEfficiencyImageCodingSequence, HighEfficiencyImageFileFormat, HighEfficiencyImageFileFormatSequence, Ico, ImpulseTrackerModule, Iso9660, JavaClass, JavaKeyStore, JointPhotographicExpertsGroup, Jpeg2000Part1, Jpeg2000Part2, Jpeg2000Part3, Jpeg2000Part6, JpegExtendedRange, JpegXl, KhronosTexture, KhronosTexture2, LempelZivFiniteStateEntropy, Lha, LongRangeZip, Lz4, Lzip, Lzop, MacOsAlias, MaterialExchangeFormat, MatroskaVideo, MicrosoftCompiledHtmlHelp, MicrosoftDirectDrawSurface, MicrosoftVirtualHardDisk, MicrosoftVirtualHardDisk2, Mobipocket, MonkeysAudio, Mpeg1Video, Mpeg4Part14Video, MpegAudioLayer3, Musepack, MusicalInstrumentDigitalInterface, NikonElectronicFile, Nintendo64Rom, NintendoDsRom, NintendoEntertainmentSystemRom, OggFlac, OggMedia, OggMultiplexedMedia, OggOpus, OggSpeex, OggTheora, OggVorbis, OlympusRawFormat, OpenExr, OpenType, OptimizedDalvikExecutable, PanasonicRaw, PcapDump, PcapNextGenerationDump, PortableDocumentFormat, PortableNetworkGraphics, QualcommPureVoice, RadianceHdr, RedHatPackageManager, RoshalArchive, ScreamTracker3Module, SeqBox, SevenZip, Shapefile, SketchUp, SmallWebFormat, Snappy, SonyDsdStreamFile, Sqlite3, TagImageFileFormat, TapeArchive, ThirdGenerationPartnershipProject, ThirdGenerationPartnershipProject2, TrueType, UnixArchiver, UnixCompress, VirtualBoxVirtualDiskImage, WavPack, WaveformAudio, WebAssemblyBinary, WebOpenFontFormat, WebOpenFontFormat2, WebP, WindowsBitmap, WindowsExecutable, WindowsMediaVideo, WindowsMetafile, WindowsShortcut, Xz, Zip, Zoo, Zstandard,
}
Expand description

A file format.

Variants

AdaptiveMultiRate

Adaptive Multi-Rate (amr)

AdobeFlashPlayerAudio

Adobe Flash Player Audio (f4a)

AdobeFlashPlayerAudiobook

Adobe Flash Player Audiobook (f4b)

AdobeFlashPlayerProtectedVideo

Adobe Flash Player Protected Video (f4p)

AdobeFlashPlayerVideo

Adobe Flash Player Video (f4v)

AdobeInDesignDocument

Adobe InDesign Document (indd)

AdobePhotoshopDocument

Adobe Photoshop Document (psd)

AdvancedAudioCoding

Advanced Audio Coding (aac)

Alz

ALZ (alz)

AndroidBinaryXml

Android Binary XML (xml)

AndroidCompiledResources

Android Compiled Resources (arsc)

Ani

ANI (ani)

AnimatedPortableNetworkGraphics

Animated Portable Network Graphics (apng)

ApacheArrowColumnar

Apache Arrow Columnar (arrow)

AppleDiskImage

Apple Disk Image (dmg)

AppleIconImage

Apple Icon Image (icns)

AppleItunesAudio

Apple iTunes Audio (m4a)

AppleItunesAudiobook

Apple iTunes Audiobook (m4b)

AppleItunesProtectedAudio

Apple iTunes Protected Audio (m4p)

AppleItunesVideo

Apple iTunes Video (m4v)

AppleQuickTime

Apple QuickTime (mov)

ArbitraryBinaryData

Arbitrary Binary Data (bin)

ArchivedByRobertJung

Archived by Robert Jung (arj)

Au

Au (au)

AudioCodec3

Audio Codec 3 (ac3)

AudioInterchangeFileFormat

Audio Interchange File Format (aiff)

AudioVideoInterleave

Audio Video Interleave (avi)

Av1ImageFileFormat

AV1 Image File Format (avif)

Av1ImageFileFormatSequence

AV1 Image File Format Sequence (avifs)

BetterPortableGraphics

Better Portable Graphics (bpg)

Blender

Blender (blend)

Bzip2

bzip2 (bz2)

Cabinet

Cabinet (cab)

CanonRaw2

Canon Raw 2 (cr2)

CanonRaw3

Canon Raw 3 (cr3)

Cineon

Cineon (cin)

CompoundFileBinary

Compound File Binary (cfb)

Cpio

cpio (cpio)

Cur

CUR (cur)

DalvikExecutable

Dalvik Executable (dex)

DebianBinaryPackage

Debian Binary Package (deb)

DigitalImagingAndCommunicationsInMedicine

Digital Imaging and Communications in Medicine (dcm)

DigitalPictureExchange

Digital Picture Exchange (dpx)

EmbeddedOpenType

Embedded OpenType (eot)

ExecutableAndLinkableFormat

Executable and Linkable Format (elf)

ExperimentalComputingFacility

Experimental Computing Facility (xcf)

ExtensibleArchive

Extensible Archive (xar)

FastTracker2ExtendedModule

FastTracker 2 Extended Module (xm)

FlashVideo

Flash Video (flv)

FlexibleImageTransportSystem

Flexible Image Transport System (fits)

FreeLosslessAudioCodec

Free Lossless Audio Codec (flac)

FreeLosslessImageFormat

Free Lossless Image Format (flif)

FujifilmRaw

Fujifilm Raw (raf)

GameBoyAdvanceRom

Game Boy Advance ROM (gba)

GameBoyColorRom

Game Boy Color ROM (gbc)

GameBoyRom

Game Boy ROM (gb)

GlTransmissionFormatBinary

GL Transmission Format Binary (glb)

GoogleChromeExtension

Google Chrome Extension (crx)

GraphicsInterchangeFormat

Graphics Interchange Format (gif)

Gzip

gzip (gz)

HighEfficiencyImageCoding

High Efficiency Image Coding (heic)

HighEfficiencyImageCodingSequence

High Efficiency Image Coding Sequence (heics)

HighEfficiencyImageFileFormat

High Efficiency Image File Format (heif)

HighEfficiencyImageFileFormatSequence

High Efficiency Image File Format Sequence (heifs)

Ico

ICO (ico)

ImpulseTrackerModule

Impulse Tracker Module (it)

Iso9660

ISO 9660 (iso)

JavaClass

Java Class (class)

JavaKeyStore

Java KeyStore (jks)

JointPhotographicExpertsGroup

Joint Photographic Experts Group (jpg)

Jpeg2000Part1

JPEG 2000 Part 1 (jp2)

Jpeg2000Part2

JPEG 2000 Part 1 (jpx)

Jpeg2000Part3

JPEG 2000 Part 3 (mj2)

Jpeg2000Part6

JPEG 2000 Part 6 (jpm)

JpegExtendedRange

JPEG Extended Range (jxr)

JpegXl

JPEG XL (jxl)

KhronosTexture

Khronos Texture (ktx)

KhronosTexture2

Khronos Texture 2 (ktx2)

LempelZivFiniteStateEntropy

Lempel–Ziv Finite State Entropy (lzfse)

Lha

LHA (lzh)

LongRangeZip

Long Range ZIP (lrz)

Lz4

LZ4 (lz4)

Lzip

lzip (lz)

Lzop

lzop (lzo)

MacOsAlias

macOS Alias (alias)

MaterialExchangeFormat

Material Exchange Format (mxf)

MatroskaVideo

Matroska Video (mkv)

MicrosoftCompiledHtmlHelp

Microsoft Compiled HTML Help (chm)

MicrosoftDirectDrawSurface

Microsoft DirectDraw Surface (dds)

MicrosoftVirtualHardDisk

Microsoft Virtual Hard Disk (vhd)

MicrosoftVirtualHardDisk2

Microsoft Virtual Hard Disk 2 (vhdx)

Mobipocket

Mobipocket (mobi)

MonkeysAudio

Monkey’s Audio (ape)

Mpeg1Video

MPEG-1 Video (mpg)

Mpeg4Part14Video

MPEG-4 Part 14 Video (mp4)

MpegAudioLayer3

MPEG-1/2 Audio Layer III (mp3)

Musepack

Musepack (mpc)

MusicalInstrumentDigitalInterface

Musical Instrument Digital Interface (mid)

NikonElectronicFile

Nikon Electronic File (nef)

Nintendo64Rom

Nintendo 64 ROM (z64)

NintendoDsRom

Nintendo DS ROM (nds)

NintendoEntertainmentSystemRom

Nintendo Entertainment System ROM (nes)

OggFlac

Ogg FLAC (oga)

OggMedia

Ogg Media (ogm)

OggMultiplexedMedia

Ogg Multiplexed Media (ogx)

OggOpus

Ogg Opus (opus)

OggSpeex

Ogg Speex (spx)

OggTheora

Ogg Theora (ogv)

OggVorbis

Ogg Vorbis (ogg)

OlympusRawFormat

Olympus Raw Format (orf)

OpenExr

OpenEXR (exr)

OpenType

OpenType (otf)

OptimizedDalvikExecutable

Optimized Dalvik Executable (dey)

PanasonicRaw

Panasonic Raw (rw2)

PcapDump

PCAP Dump (pcap)

PcapNextGenerationDump

PCAP Next Generation Dump (pcapng)

PortableDocumentFormat

Portable Document Format (pdf)

PortableNetworkGraphics

Portable Network Graphics (png)

QualcommPureVoice

Qualcomm PureVoice (qcp)

RadianceHdr

Radiance HDR (hdr)

RedHatPackageManager

Red Hat Package Manager (rpm)

RoshalArchive

Roshal Archive (rar)

ScreamTracker3Module

ScreamTracker 3 Module (s3m)

SeqBox

SeqBox (sbx)

SevenZip

7-Zip (7z)

Shapefile

Shapefile (shp)

SketchUp

SketchUp (skp)

SmallWebFormat

Small Web Format (swf)

Snappy

Snappy (sz)

SonyDsdStreamFile

Sony DSD Stream File (dsf)

Sqlite3

SQLite 3 (sqlite)

TagImageFileFormat

Tag Image File Format (tiff)

TapeArchive

Tape Archive (tar)

ThirdGenerationPartnershipProject

3rd Generation Partnership Project (3gp)

ThirdGenerationPartnershipProject2

3rd Generation Partnership Project 2 (3g2)

TrueType

TrueType (ttf)

UnixArchiver

UNIX archiver (ar)

UnixCompress

UNIX compress (Z)

VirtualBoxVirtualDiskImage

VirtualBox Virtual Disk Image (vdi)

WavPack

WavPack (wv)

WaveformAudio

Waveform Audio (wav)

WebAssemblyBinary

WebAssembly Binary (wasm)

WebOpenFontFormat

Web Open Font Format (woff)

WebOpenFontFormat2

Web Open Font Format 2 (woff2)

WebP

WebP (webp)

WindowsBitmap

Windows Bitmap (bmp)

WindowsExecutable

Windows Executable (exe)

WindowsMediaVideo

Windows Media Video (wmv)

WindowsMetafile

Windows Metafile (wmf)

WindowsShortcut

Windows Shortcut (lnk)

Xz

XZ (xz)

Zip

ZIP (zip)

Zoo

zoo (zoo)

Zstandard

Zstandard (zst)

Implementations

Returns the name of the FileFormat.

Examples
use file_format::FileFormat;

let format = FileFormat::MpegAudioLayer3;
assert_eq!(format.name(), "MPEG-1/2 Audio Layer III");

Returns the media type (formerly known as MIME type) of the FileFormat.

Examples
use file_format::FileFormat;

let format = FileFormat::Zstandard;
assert_eq!(format.media_type(), "application/zstd");

Returns the extension of the FileFormat.

Examples
use file_format::FileFormat;

let format = FileFormat::WindowsMediaVideo;
assert_eq!(format.extension(), "wmv");

Determines FileFormat from bytes.

If the FileFormat is not recognized, the default value will be returned.

Examples

Detects from the first bytes of a PNG file:

use file_format::FileFormat;

let format = FileFormat::from_bytes(b"\x89\x50\x4E\x47\x0D\x0A\x1A\x0A");
assert_eq!(format, FileFormat::PortableNetworkGraphics);

Detects from a zeroed buffer:

use file_format::FileFormat;

let format = FileFormat::from_bytes(&[0; 1000]);
assert_eq!(format, FileFormat::ArbitraryBinaryData);

Determines FileFormat from a file.

Examples
use file_format::FileFormat;

let format = FileFormat::from_file("fixtures/video/sample.mkv")?;
assert_eq!(format, FileFormat::MatroskaVideo);

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the default FileFormat which corresponds to FileFormat::ArbitraryBinaryData.

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

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

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

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.