pub struct BoundFileRef { /* private fields */ }Expand description
A FileRef with table context attached.
Implementations§
Source§impl BoundFileRef
impl BoundFileRef
Sourcepub fn new(file_ref: FileRef, context: FileRefContext) -> Self
pub fn new(file_ref: FileRef, context: FileRefContext) -> Self
Create a bound file reference from a raw file reference and context.
Sourcepub fn into_file_ref(self) -> FileRef
pub fn into_file_ref(self) -> FileRef
Consume the bound reference and return the underlying file reference.
Sourcepub fn context(&self) -> &FileRefContext
pub fn context(&self) -> &FileRefContext
Borrow the context attached to this file reference.
Sourcepub fn download_url(&self, base_url: &str) -> String
pub fn download_url(&self, base_url: &str) -> String
Full download URL for this file.
Sourcepub fn relative_url(&self) -> String
pub fn relative_url(&self) -> String
Relative HTTP path for this file.
Methods from Deref<Target = FileRef>§
Sourcepub fn download_url(
&self,
base_url: &str,
namespace: &str,
table: &str,
) -> String
pub fn download_url( &self, base_url: &str, namespace: &str, table: &str, ) -> String
Full download URL for this file.
Sourcepub fn relative_url(&self, namespace: &str, table: &str) -> String
pub fn relative_url(&self, namespace: &str, table: &str) -> String
Relative HTTP path for this file.
Sourcepub fn stored_name(&self) -> String
pub fn stored_name(&self) -> String
Stored filename on disk.
Sourcepub fn relative_path(&self) -> String
pub fn relative_path(&self) -> String
Relative path within the table folder.
Sourcepub fn type_description(&self) -> String
pub fn type_description(&self) -> String
Human-readable file type description.
Sourcepub fn format_size(&self) -> String
pub fn format_size(&self) -> String
Format file size in human-readable units.
Sourcepub fn validate_mime_type(&self, allowed_mimes: &[String]) -> bool
pub fn validate_mime_type(&self, allowed_mimes: &[String]) -> bool
Validate MIME type against an allowlist.
Trait Implementations§
Source§impl Clone for BoundFileRef
impl Clone for BoundFileRef
Source§fn clone(&self) -> BoundFileRef
fn clone(&self) -> BoundFileRef
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BoundFileRef
impl Debug for BoundFileRef
Source§impl Deref for BoundFileRef
impl Deref for BoundFileRef
Source§impl<'de> Deserialize<'de> for BoundFileRef
impl<'de> Deserialize<'de> for BoundFileRef
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 BoundFileRef
Source§impl PartialEq for BoundFileRef
impl PartialEq for BoundFileRef
Source§fn eq(&self, other: &BoundFileRef) -> bool
fn eq(&self, other: &BoundFileRef) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for BoundFileRef
impl Serialize for BoundFileRef
impl StructuralPartialEq for BoundFileRef
Auto Trait Implementations§
impl Freeze for BoundFileRef
impl RefUnwindSafe for BoundFileRef
impl Send for BoundFileRef
impl Sync for BoundFileRef
impl Unpin for BoundFileRef
impl UnsafeUnpin for BoundFileRef
impl UnwindSafe for BoundFileRef
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