Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Serde, Strum and From features #63

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ documentation = "https://docs.rs/file-format"
exclude = ["/.github", "/examples", "/fixtures", "/tests", ".gitattributes", ".gitignore"]
rust-version = "1.60.0"

[dependencies]
serde = { version = "1", features = ["derive"], default-features = false, optional = true }
strum = { version = "0.26", features = ["derive"], optional = true }

[features]
## Reader features
reader = [
Expand All @@ -40,3 +44,15 @@ reader-sqlite3 = []
reader-txt = []
reader-xml = []
reader-zip = []
serde = [
"dep:serde"
]
extended-enums = [
"dep:strum"
]
from-all = [
"from-media-type",
"from-extension"
]
from-media-type = []
from-extension = []
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,19 @@ identification.
- `reader-xml` - Enables Extensible Markup Language (XML) based file formats detection.
- `reader-zip` - Enables ZIP-based file formats detection.

### Serde feature
Serde support is optional and disabled by default. To enable use the feature `serde`.

### Extended enums feature
To use various additional methods for enums derived by `strum`. To enable use the feature `extended-enums`.

### From features

These features enable the detection of file formats by a specific value like media type or extension.
- `from-all` - Enables all from features.
- `from-media-type` - Enables the method `FileFormat::from_media_type` to get possible file formats for a media type.
- `from-extension` - Enables the method `FileFormat::from_extension` to get possible file formats for an extension.

## Supported file formats

### Archive
Expand Down
Loading
Loading