pub struct AttachmentResolver { /* private fields */ }Expand description
Resolves attachment targets relative to the knowledge base root.
Implementations§
Source§impl AttachmentResolver
impl AttachmentResolver
Sourcepub fn new(root: impl AsRef<Path>) -> Self
pub fn new(root: impl AsRef<Path>) -> Self
Creates a resolver rooted at the knowledge base path.
Sourcepub fn resolve(&self, raw: &str) -> Result<ResolvedAttachment, AttachmentError>
pub fn resolve(&self, raw: &str) -> Result<ResolvedAttachment, AttachmentError>
Resolves an attachment target to a path and existence flag.
Sourcepub fn resolve_path(&self, raw: &str) -> Option<PathBuf>
pub fn resolve_path(&self, raw: &str) -> Option<PathBuf>
Resolves an attachment target to a path only (ignores missing).
Sourcepub fn resolve_existing(&self, raw: &str) -> Result<PathBuf, AttachmentError>
pub fn resolve_existing(&self, raw: &str) -> Result<PathBuf, AttachmentError>
Resolves an attachment target and ensures the file exists.
Trait Implementations§
Source§impl Clone for AttachmentResolver
impl Clone for AttachmentResolver
Source§fn clone(&self) -> AttachmentResolver
fn clone(&self) -> AttachmentResolver
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 moreAuto Trait Implementations§
impl Freeze for AttachmentResolver
impl RefUnwindSafe for AttachmentResolver
impl Send for AttachmentResolver
impl Sync for AttachmentResolver
impl Unpin for AttachmentResolver
impl UnsafeUnpin for AttachmentResolver
impl UnwindSafe for AttachmentResolver
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