c2pa-rs icon indicating copy to clipboard operation
c2pa-rs copied to clipboard

Create a `Format` enum for file format/mime type

Open ok-nick opened this issue 5 months ago • 1 comments

It's not clear in the API which file formats/mime types are supported. We also often end up string matching when dealing with different file formats. I think we can make some big improvements by introducing a Format enum similar to image::ImageFormat.

We can provide methods such as:

  • c2pa::format_from_path -> Format::from_path
  • Format::from_extension
  • Format::from_mime_type
  • Format::mime_type
  • Format::format
  • Format::extensions
  • Format::can_read
  • Format::can_write

Source: https://github.com/contentauth/c2pa-rs/pull/1260#discussion_r2229607467

ok-nick avatar Jul 29 '25 14:07 ok-nick