pub struct TarFS { /* private fields */ }Implementations§
Source§impl TarFS
impl TarFS
Sourcepub fn from_device(device: impl Device + 'static) -> Option<TarFS>
pub fn from_device(device: impl Device + 'static) -> Option<TarFS>
Examples found in repository?
examples/dump.rs (line 13)
4fn main() {
5 let filename = match std::env::args().skip(1).next() {
6 Some(f) => f,
7 None => {
8 eprintln!("Please provide the name of a file.");
9 std::process::exit(1);
10 },
11 };
12
13 let fs = TarFS::from_device(FileDevice(File::open(filename).unwrap()));
14
15 if fs.is_none() {
16 println!("Failed to open TAR file.");
17 return;
18 }
19
20 let mut fs = fs.unwrap();
21
22 let ents = fs.list();
23
24 for i in ents {
25 let i = i.unwrap();
26
27 println!("{:40} - {:12} bytes", &i.name, i.size);
28 }
29}pub fn get_entries<'a>(&'a mut self) -> EntryIter<'a> ⓘ
Sourcepub fn list<'a>(&'a mut self) -> EntityIter<'a> ⓘ
pub fn list<'a>(&'a mut self) -> EntityIter<'a> ⓘ
Examples found in repository?
examples/dump.rs (line 22)
4fn main() {
5 let filename = match std::env::args().skip(1).next() {
6 Some(f) => f,
7 None => {
8 eprintln!("Please provide the name of a file.");
9 std::process::exit(1);
10 },
11 };
12
13 let fs = TarFS::from_device(FileDevice(File::open(filename).unwrap()));
14
15 if fs.is_none() {
16 println!("Failed to open TAR file.");
17 return;
18 }
19
20 let mut fs = fs.unwrap();
21
22 let ents = fs.list();
23
24 for i in ents {
25 let i = i.unwrap();
26
27 println!("{:40} - {:12} bytes", &i.name, i.size);
28 }
29}pub fn list_by_path(&mut self, path: &str) -> Result<Vec<Entity>>
pub fn list_by_path_shallow(&mut self, path: &str) -> Result<Vec<Entity>>
pub fn find_file(&mut self, path: &str) -> Result<Entity>
pub fn read_file_by_entity( &mut self, entity: &Entity, position: usize, output: &mut [u8], ) -> Result<usize>
pub fn read_file( &mut self, path: &str, position: usize, output: &mut [u8], ) -> Result<usize>
pub fn read_entire_file(&mut self, path: &str) -> Result<Vec<u8>>
pub fn read_to_string(&mut self, path: &str) -> Result<String>
Auto Trait Implementations§
impl Freeze for TarFS
impl !RefUnwindSafe for TarFS
impl !Send for TarFS
impl !Sync for TarFS
impl Unpin for TarFS
impl !UnwindSafe for TarFS
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