pub struct ContainerFile {
    abiver: u16,
    filety: u8,
    sections: IndexMap<String, Section>,
}
Expand description

A CCFF container file.

This will contain all the sections of data (somewhat similar in theory to ELF sections) as well as some basic metadata about the file: its ABI version and file type, both of which are user-defined.

It also stores a list of Sections, which can be accessed and modified via methods on this structure such as get_section and add_section. The order of these sections is stored, however this is not guaranteed or required and may be changed in the future.

Fields§

§abiver: u16§filety: u8§sections: IndexMap<String, Section>

Implementations§

Create a new container file. The ABI version (abiver) and file type (filety) may be any arbitrary user-defined value.

Set the ABI version of the container file. This may be any arbitrary user-defined value.

Get the ABI version of the container file.

Set the file type of the container file. This may be any arbitrary user-defined value.

Get the file type of the container file.

Add a section to the container file. If there was already a section with this name present, it will be replaced and returned.

Panics

This function will panic if the name of the section was longer than 255 characters, if the name of the section contained non-printable ASCII characters (less than 0x21 or greater than 0x7E), or if there were already 255 sections in the container file.

Remove a section from the container file. The removed section, if any, will be returned.

Get a reference to a section in the container file.

Get a mutable reference to a section in the container file.

Iterate over the sections in the container file.

Iterate mutably over the sections in the container file.

Get the size of the entire container file.

Decode this container file from the buffer provided.

Errors

This function will return an error if the input fails to parse.

Encode this container file to the buffer provided. To allocate a sufficiently sized buffer, use Vec::with_capacity using the size given by ContainerFile::size.

Panics

This function will panic if a section was too large (larger than u32::MAX in bytes) or if there was too much data in the container file (due to architectural limitations, they are capped at around 4GiB)

Encode this container file to a newly allocated buffer.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Which kind of iterator are we turning this into?
The type of the elements being iterated over.
Creates an iterator from a value. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Compare self to key and return true if they are equal.

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.