pub enum ContentSource {
Inline {
content: FileContent,
},
File {
path: PathBuf,
},
Url {
url: String,
},
}Expand description
Source of file content - inline or external reference.
Represents where file content comes from, allowing flexibility in how archives store their data. Content can be embedded directly, referenced from filesystem, fetched from URLs, or retrieved via custom user-defined mechanisms.
§Variants
Inline: Content embedded directly in the archive (default behavior)File: Reference to a file in the local filesystemUrl: Reference to a remote resource (HTTP/HTTPS)
§Examples
use genfile_core::{ ContentSource, FileContent };
use std::path::PathBuf;
// Inline content
let inline = ContentSource::Inline
{
content: FileContent::Text( "Hello {{name}}".into() ),
};
// File reference
let file_ref = ContentSource::File
{
path: PathBuf::from( "/templates/main.hbs" ),
};
// Remote URL
let remote = ContentSource::Url
{
url: "https://example.com/template.hbs".into(),
};Variants§
Inline
Content embedded directly in archive
Fields
§
content: FileContentThe actual file content
File
Reference to file in local filesystem
Url
Reference to remote resource
Implementations§
Source§impl ContentSource
impl ContentSource
Sourcepub fn as_inline(&self) -> Option<&FileContent>
pub fn as_inline(&self) -> Option<&FileContent>
Get inline content if available
Sourcepub fn as_file_path(&self) -> Option<&Path>
pub fn as_file_path(&self) -> Option<&Path>
Get file path if this is a file reference
Trait Implementations§
Source§impl Clone for ContentSource
impl Clone for ContentSource
Source§fn clone(&self) -> ContentSource
fn clone(&self) -> ContentSource
Returns a duplicate of the value. Read more
1.0.0 · 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 ContentSource
impl Debug for ContentSource
Source§impl<'de> Deserialize<'de> for ContentSource
impl<'de> Deserialize<'de> for ContentSource
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
Source§impl IntoContentSource for ContentSource
impl IntoContentSource for ContentSource
Source§fn into_content_source(self) -> ContentSource
fn into_content_source(self) -> ContentSource
Convert self into a
ContentSourceAuto Trait Implementations§
impl Freeze for ContentSource
impl RefUnwindSafe for ContentSource
impl Send for ContentSource
impl Sync for ContentSource
impl Unpin for ContentSource
impl UnwindSafe for ContentSource
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