pub struct ArchiveStack { /* private fields */ }
Expand description
A utility struct to keep track of the current archive stack. This is useful when processing nested archives - it supports pushing and popping archives from the stack, and provides the current nested path - including all previous nested paths.
§Example
let mut stack = ArchiveStack::new();
stack.push_archive("first.tar");
stack.push_archive("second.tar");
assert_eq!(stack.nested_path(), Path::new("first.tar/second.tar"));
assert_eq!(stack.current_depth(), 2);
stack.pop_archive();
assert_eq!(stack.nested_path(), Path::new("first.tar"));
Implementations§
Source§impl ArchiveStack
impl ArchiveStack
pub fn new() -> Self
pub fn push_archive(&mut self, path: impl AsRef<Path>) -> &Path
pub fn pop_archive(&mut self) -> &Path
pub fn current_depth(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn nested_path(&self) -> &Path
Trait Implementations§
Source§impl Debug for ArchiveStack
impl Debug for ArchiveStack
Source§impl Default for ArchiveStack
impl Default for ArchiveStack
Source§fn default() -> ArchiveStack
fn default() -> ArchiveStack
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ArchiveStack
impl RefUnwindSafe for ArchiveStack
impl Send for ArchiveStack
impl Sync for ArchiveStack
impl Unpin for ArchiveStack
impl UnwindSafe for ArchiveStack
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