pub struct EncodedDepInfo {
pub files: Vec<(DepInfoPathType, PathBuf, Option<(u64, String)>)>,
pub env: Vec<(String, Option<String>)>,
}
Expand description
Same as RustcDepInfo
except avoids absolute paths as much as possible to
allow moving around the target directory.
This is also stored in an optimized format to make parsing it fast because Cargo will read it for crates on all future compilations.
Currently the format looks like:
+--------+---------+------------+------------+---------------+---------------+
| marker | version | # of files | file paths | # of env vars | env var pairs |
+--------+---------+------------+------------+---------------+---------------+
Each field represents
-
Marker — A magic marker to ensure that older Cargoes, which only recognize format v0 (prior to checksum support in
f4ca7390
), do not proceed with parsing newer formats. SinceEncodedDepInfo
is merely an optimization, and to avoid adding complexity, Cargo recognizes only one version ofCURRENT_ENCODED_DEP_INFO_VERSION
. The current layout looks like this+----------------------------+ | [0x01 0x00 0x00 0x00 0xff] | +----------------------------+
These bytes will be interpreted as “one file tracked and an invalid
DepInfoPathType
variant with 255” by older Cargoes, causing them to stop parsing. This could prevent problematic parsing as noted in rust-lang/cargo#14712. -
Version — The current format version.
-
Number of files/envs — A
u32
representing the number of things. -
File paths — Zero or more paths of files the dep-info file depends on. Each path is encoded as the following:
+-----------+-------------+------------+---------------+-----------+-------+ | path type | len of path | path bytes | cksum exists? | file size | cksum | +-----------+-------------+------------+---------------+-----------+-------+
-
Env var pairs — Zero or more env vars the dep-info file depends on. Each env key-value pair is encoded as the following:
+------------+-----------+---------------+--------------+-------------+ | len of key | key bytes | value exists? | len of value | value bytes | +------------+-----------+---------------+--------------+-------------+
Fields§
§files: Vec<(DepInfoPathType, PathBuf, Option<(u64, String)>)>
§env: Vec<(String, Option<String>)>
Implementations§
Source§impl EncodedDepInfo
impl EncodedDepInfo
pub fn parse(bytes: &[u8]) -> Option<EncodedDepInfo>
pub fn serialize(&self) -> CargoResult<Vec<u8>>
Trait Implementations§
Source§impl Debug for EncodedDepInfo
impl Debug for EncodedDepInfo
Source§impl Default for EncodedDepInfo
impl Default for EncodedDepInfo
Source§fn default() -> EncodedDepInfo
fn default() -> EncodedDepInfo
Source§impl PartialEq for EncodedDepInfo
impl PartialEq for EncodedDepInfo
impl Eq for EncodedDepInfo
impl StructuralPartialEq for EncodedDepInfo
Auto Trait Implementations§
impl Freeze for EncodedDepInfo
impl RefUnwindSafe for EncodedDepInfo
impl Send for EncodedDepInfo
impl Sync for EncodedDepInfo
impl Unpin for EncodedDepInfo
impl UnwindSafe for EncodedDepInfo
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
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 48 bytes