pub enum Format {
Gguf,
SafeTensors,
Onnx,
}Expand description
A supported ML model container format.
Variants§
Implementations§
Source§impl Format
impl Format
Sourcepub fn detect(data: &[u8]) -> Option<Format>
pub fn detect(data: &[u8]) -> Option<Format>
Detect the container format from the leading bytes.
GGUF and SafeTensors are recognized structurally; ONNX has no magic
number and is matched last as a best-effort protobuf shape check (see
onnx::is_onnx), so it can yield a false positive on unrelated
protobuf. When the format is known in advance, prefer
embed_manifest_as over auto-detection.
Sourcepub fn model_type(self) -> ModelType
pub fn model_type(self) -> ModelType
The most specific C2PA ModelType for this container. GGUF and
SafeTensors are framework-agnostic containers, so they map to the generic
c2pa.types.model; ONNX maps to c2pa.types.model.onnx.
Trait Implementations§
impl Copy for Format
impl Eq for Format
impl StructuralPartialEq for Format
Auto Trait Implementations§
impl Freeze for Format
impl RefUnwindSafe for Format
impl Send for Format
impl Sync for Format
impl Unpin for Format
impl UnsafeUnpin for Format
impl UnwindSafe for Format
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