Struct cpio::newc::Builder

source ·
pub struct Builder { /* private fields */ }
Expand description

Builds metadata for one entry to be written into an archive.

Implementations§

source§

impl Builder

source

pub fn new(name: &str) -> Self

Create the metadata for one CPIO entry

Examples found in repository?
examples/createcpio.rs (line 8)
7
8
9
10
11
12
13
14
15
fn load_file(path: &str) -> io::Result<(NewcBuilder, File)> {
	let builder = NewcBuilder::new(path)
		.uid(1000)
		.gid(1000)
		.mode(0o100644);
		
	File::open(path)
		.map(|fp| (builder, fp))
}
source

pub fn ino(self, ino: u32) -> Self

Set the inode number for this file. In modern times however, typically this is just a a unique index ID for the file, rather than the actual inode number.

source

pub fn mode(self, mode: u32) -> Self

Set the file’s “mode” - the same as an inode “mode” field - containing permission bits and a bit of metadata about the type of file represented.

Examples found in repository?
examples/createcpio.rs (line 11)
7
8
9
10
11
12
13
14
15
fn load_file(path: &str) -> io::Result<(NewcBuilder, File)> {
	let builder = NewcBuilder::new(path)
		.uid(1000)
		.gid(1000)
		.mode(0o100644);
		
	File::open(path)
		.map(|fp| (builder, fp))
}
source

pub fn uid(self, uid: u32) -> Self

Set this file’s UID.

Examples found in repository?
examples/createcpio.rs (line 9)
7
8
9
10
11
12
13
14
15
fn load_file(path: &str) -> io::Result<(NewcBuilder, File)> {
	let builder = NewcBuilder::new(path)
		.uid(1000)
		.gid(1000)
		.mode(0o100644);
		
	File::open(path)
		.map(|fp| (builder, fp))
}
source

pub fn gid(self, gid: u32) -> Self

Set this file’s GID.

Examples found in repository?
examples/createcpio.rs (line 10)
7
8
9
10
11
12
13
14
15
fn load_file(path: &str) -> io::Result<(NewcBuilder, File)> {
	let builder = NewcBuilder::new(path)
		.uid(1000)
		.gid(1000)
		.mode(0o100644);
		
	File::open(path)
		.map(|fp| (builder, fp))
}

Set the number of links associated with this file.

source

pub fn mtime(self, mtime: u32) -> Self

Set the modification time of this file.

source

pub fn dev_major(self, dev_major: u32) -> Self

Set the major component of the device ID, describing the device on which this file resides.

Device IDs are comprised of a major and minor component. The major component identifies the class of device, while the minor component identifies a specific device of that class.

source

pub fn dev_minor(self, dev_minor: u32) -> Self

Set the minor component of the device ID, describing the device on which this file resides.

Device IDs are comprised of a major and minor component. The major component identifies the class of device, while the minor component identifies a specific device of that class.

source

pub fn rdev_major(self, rdev_major: u32) -> Self

Set the major component of the rdev ID, describes the device that this file (inode) represents.

Device IDs are comprised of a major and minor component. The major component identifies the class of device, while the minor component identifies a specific device of that class.

source

pub fn rdev_minor(self, rdev_minor: u32) -> Self

Set the minor component of the rdev ID, field describes the device that this file (inode) represents.

Device IDs are comprised of a major and minor component. The major component identifies the class of device, while the minor component identifies a specific device of that class.

source

pub fn set_mode_file_type(self, file_type: ModeFileType) -> Self

Set the mode file type of the entry

source

pub fn write<W: Write>(self, w: W, file_size: u32) -> Writer<W>

Write out an entry to the provided writer in SVR4 “new ascii” CPIO format.

source

pub fn write_crc<W: Write>( self, w: W, file_size: u32, file_checksum: u32 ) -> Writer<W>

Write out an entry to the provided writer in SVR4 “new crc” CPIO format.

Trait Implementations§

source§

impl Clone for Builder

source§

fn clone(&self) -> Builder

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.