pub struct ModelFile {
pub name: String,
pub sha256: String,
pub size: u64,
pub url: Option<String>,
}Expand description
One file required by a model manifest.
Fields§
§name: StringRelative path inside the model directory.
sha256: StringExpected lowercase SHA256 hex digest.
size: u64Expected size in bytes.
url: Option<String>Explicit download URL. When None, the URL is derived from the parent
manifest’s repo + revision using the HuggingFace /resolve/ path.
Implementations§
Source§impl ModelFile
impl ModelFile
Sourcepub fn uses_placeholder_checksum(&self) -> bool
pub fn uses_placeholder_checksum(&self) -> bool
Returns true when the file still uses the placeholder checksum.
Sourcepub fn has_verified_checksum(&self) -> bool
pub fn has_verified_checksum(&self) -> bool
Returns true when checksum is usable for production verification.
Sourcepub fn local_name(&self) -> &str
pub fn local_name(&self) -> &str
Get the local filename (basename) for saving.
For paths like "onnx/model.onnx", returns "model.onnx".
This handles HuggingFace repos that restructure files into subdirectories.
Sourcepub fn download_url(&self, repo: &str, revision: &str) -> String
pub fn download_url(&self, repo: &str, revision: &str) -> String
Return the download URL for this file, preferring the explicit url
field and falling back to the standard HuggingFace /resolve/ path.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ModelFile
impl<'de> Deserialize<'de> for ModelFile
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for ModelFile
impl StructuralPartialEq for ModelFile
Auto Trait Implementations§
impl Freeze for ModelFile
impl RefUnwindSafe for ModelFile
impl Send for ModelFile
impl Sync for ModelFile
impl Unpin for ModelFile
impl UnsafeUnpin for ModelFile
impl UnwindSafe for ModelFile
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).