const block_size
pub const block_size = 512用途
公开常量 `block_size`。 值为 `512`
参数
无
API
#archive/tarustar 子集:Header + Reader/Writer。归档为 owning 字符串。
const block_sizepub const block_size = 512公开常量 `block_size`。 值为 `512`
无
const type_regpub const type_reg = 48公开常量 `type_reg`。 值为 `48`
无
const type_linkpub const type_link = 49公开常量 `type_link`。 值为 `49`
无
const type_symlinkpub const type_symlink = 50公开常量 `type_symlink`。 值为 `50`
无
const type_dirpub const type_dir = 53公开常量 `type_dir`。 值为 `53`
无
const type_gnu_longlinkpub const type_gnu_longlink = 75公开常量 `type_gnu_longlink`。 值为 `75`
无
const type_gnu_longnamepub const type_gnu_longname = 76公开常量 `type_gnu_longname`。 值为 `76`
无
struct Headerpub struct Header {
pub name string
pub size int
pub mode int
pub typeflag int
pub linkname string
pub uname string
pub gname string
pub mtime int
}公开结构体 `Header`。
name stringsize intmode inttypeflag intlinkname stringuname stringgname stringmtime intstruct Filepub struct File {
pub name string
pub size int
pub mode int
pub typeflag int
pub linkname string
pub uname string
pub gname string
pub mtime int
pub body string
}公开结构体 `File`。
name stringsize intmode inttypeflag intlinkname stringuname stringgname stringmtime intbody stringstruct Readerpub struct Reader {
pub data string
pub pos int
}公开结构体 `Reader`。
data stringpos intstruct Writerpub struct Writer {
pub buf string
pub closed int
pub nfiles int
}公开结构体 `Writer`。
buf stringclosed intnfiles intnew_headerpub fn new_header() Header构造 header。
无
Header — 该类型的值
new_readerpub fn new_reader(data &string) Reader构造 reader。
data &stringReader — 该类型的值
new_writerpub fn new_writer() Writer构造 writer。
无
Writer — 该类型的值
(&Writer) file_countpub fn (w &Writer) file_count() int`&Writer` 上的方法:文件计数。
w &Writerint — 该类型的值
encode_headerpub fn encode_header(h &Header) string编码。失败时 throw。
h &Headerstring — 结果字符串
parse_headerpub fn parse_header(blk &string) Header解析为 header。失败时 throw。
blk &stringHeader — 该类型的值
(&mut Reader) nextpub fn (r &mut Reader) next() File`&mut Reader` 上的方法:取出下一项;没有则按本类型约定结束。失败时 throw。
r &mut ReaderFile — 该类型的值
(&Writer) bytespub fn (w &Writer) bytes() string`&Writer` 上的方法:返回已缓冲的字节串。
w &Writerstring — 结果字符串
(&mut Writer) write_headerpub fn (w &mut Writer) write_header(h &Header, body &string) int`&mut Writer` 上的方法:写入头。失败时 throw。
w &mut Writerh &Headerbody &stringint — 该类型的值
(&mut Writer) write_filepub fn (w &mut Writer) write_file(name &string, body &string, mode int) int`&mut Writer` 上的方法:写入文件。失败时 throw。
w &mut Writername &stringbody &stringmode intint — 该类型的值
(&mut Writer) write_dirpub fn (w &mut Writer) write_dir(name &string, mode int) int`&mut Writer` 上的方法:写入目录部分。失败时 throw。
w &mut Writername &stringmode intint — 该类型的值
(&mut Writer) closepub fn (w &mut Writer) close() int`&mut Writer` 上的方法:关闭资源。
w &mut Writerint — 该类型的值