pub struct FsLoader { /* private fields */ }Expand description
File-system loader.
This is a special JSON-LD document loader that can load document from the file system by attaching a directory to specific URLs.
Loaded documents are not cached: a new file system read is made each time an URL is loaded even if it has already been queried before.
Implementations§
Source§impl FsLoader
impl FsLoader
Sourcepub fn mount<P: AsRef<Path>>(&mut self, url: IriBuf, path: P)
pub fn mount<P: AsRef<Path>>(&mut self, url: IriBuf, path: P)
Bind the given IRI prefix to the given path.
Any document with an IRI matching the given prefix will be loaded from the referenced local directory.
Sourcepub fn filepath(&self, url: Iri<&str>) -> Option<PathBuf>
pub fn filepath(&self, url: Iri<&str>) -> Option<PathBuf>
Returns the local file path associated to the given url if any.
The URL must match a mount point at a path boundary (mounting
http://example.com/a does not capture http://example.com/abc), and
the path is built only from single normal components: URLs containing
. or .. segments (or segments the platform would split further,
like \ on Windows) return None.
This bounds the constructed path to the mounted directory. It does not follow the file system: a symbolic link inside the mount can still point outside it, so mount only directories whose contents you trust.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FsLoader
impl RefUnwindSafe for FsLoader
impl Send for FsLoader
impl Sync for FsLoader
impl Unpin for FsLoader
impl UnsafeUnpin for FsLoader
impl UnwindSafe for FsLoader
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
Source§impl<T> BorrowUnordered for T
impl<T> BorrowUnordered for T
Source§fn as_unordered(&self) -> &Unordered<T>
fn as_unordered(&self) -> &Unordered<T>
Unordered reference.