pub enum TextFile {
Local(Arc<PathBuf>),
Remote(Url),
}Expand description
Asset key for text file content.
Variants§
Implementations§
Source§impl TextFile
impl TextFile
Sourcepub fn parse(s: &str) -> Result<Self, EureQueryError>
pub fn parse(s: &str) -> Result<Self, EureQueryError>
Parse a string as either a URL (if starts with https://) or a local path.
Sourcepub fn resolve(target: &str, base_dir: &Path) -> Result<Self, EureQueryError>
pub fn resolve(target: &str, base_dir: &Path) -> Result<Self, EureQueryError>
Resolve a schema/file reference relative to a base directory.
- If
targetstarts with “https://”, returns aTextFile::Remote - Otherwise, joins
targetwithbase_dirand returns aTextFile::Local
Sourcepub fn new(path: Arc<PathBuf>) -> Self
pub fn new(path: Arc<PathBuf>) -> Self
Create a TextFile from an Arc
Sourcepub fn as_local_path(&self) -> Option<&Path>
pub fn as_local_path(&self) -> Option<&Path>
Get the local path if this is a local file.
Trait Implementations§
Source§impl AssetLocator<TextFile> for TextFileLocator
impl AssetLocator<TextFile> for TextFileLocator
Source§fn locate(
&self,
db: &impl Db,
key: &TextFile,
) -> Result<LocateResult<TextFileContent>, QueryError>
fn locate( &self, db: &impl Db, key: &TextFile, ) -> Result<LocateResult<TextFileContent>, QueryError>
Attempt to locate an asset for the given key. Read more
impl Eq for TextFile
impl StructuralPartialEq for TextFile
Auto Trait Implementations§
impl Freeze for TextFile
impl RefUnwindSafe for TextFile
impl Send for TextFile
impl Sync for TextFile
impl Unpin for TextFile
impl UnwindSafe for TextFile
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.