pub enum SourceData {
File(Box<dyn Read + Sync + Send>),
Dir(Box<dyn Iterator<Item = (OsString, u32)> + Sync + Send>),
Symlink(PathBuf),
BlockDev(u32, u32),
CharDev(u32, u32),
Fifo,
Socket,
}
Expand description
Represents the data of a filesystem object that can be added to an archive.
When creating the archive, this object is read from a Source
(which additionally describes
the filesystem attributes of the node) and used to set the type and contents of the node.
Variants§
File(Box<dyn Read + Sync + Send>)
Create a file with the provided contents.
The contained object will be read and its contents placed in the file written to the archive.
Dir(Box<dyn Iterator<Item = (OsString, u32)> + Sync + Send>)
Create a directory with the given chidren.
The creator must provide an iterator over OsString
and u32
, which respectively
represent the name and inode number of each child of this directory. This is one of the
hardest parts about writing archive contents – all children of each directory must be
written before the directory itself, so that the inode numbers of the children are known.
TreeProcessor
facilitates this by performing a post-order traversal of a filesystem,
ensuring that files are written in the correct order.
Symlink(PathBuf)
Create a symbolic link to the given path.
It is not required for the target of the symlink to exist.
BlockDev(u32, u32)
Create a block device file with the given major and minor device numbers.
CharDev(u32, u32)
Create a character device file with the given major and minor device numbers.
Fifo
Create a named pipe.
Socket
Create a socket.