Skip to main content

## LogMessage

# Enum LogMessage

Source

    pub enum LogMessage {
        BuildStarted {
            command: Vec<String>,
            cwd: PathBuf,
            host: String,
            jobs: u32,
            num_cpus: Option<u64>,
            profile: String,
            rustc_version: String,
            rustc_version_verbose: String,
            target_dir: PathBuf,
            workspace_root: PathBuf,
        },
        ResolutionStarted {
            elapsed: f64,
        },
        ResolutionFinished {
            elapsed: f64,
        },
        UnitGraphStarted {
            elapsed: f64,
        },
        UnitGraphFinished {
            elapsed: f64,
        },
        UnitRegistered {
            package_id: PackageIdSpec,
            target: Target,
            mode: CompileMode,
            platform: String,
            index: UnitIndex,
            features: Vec<String>,
            requested: bool,
            dependencies: Vec<UnitIndex>,
        },
        UnitStarted {
            index: UnitIndex,
            elapsed: f64,
        },
        UnitRmetaFinished {
            index: UnitIndex,
            elapsed: f64,
            unblocked: Vec<UnitIndex>,
        },
        UnitSectionStarted {
            index: UnitIndex,
            elapsed: f64,
            section: String,
        },
        UnitSectionFinished {
            index: UnitIndex,
            elapsed: f64,
            section: String,
        },
        UnitFinished {
            index: UnitIndex,
            elapsed: f64,
            unblocked: Vec<UnitIndex>,
        },
        UnitFingerprint {
            index: UnitIndex,
            status: FingerprintStatus,
            cause: Option<DirtyReason>,
        },
    }

Expand description

A log message.

Each variant represents a different type of event.

## Variants§

§

### BuildStarted

Emitted when a build starts.

#### Fields

§`command: Vec<String>`

The command-line arguments Cargo was invoked with.

§`cwd: PathBuf`

Current working directory.

§`host: String`

Host triple.

§`jobs: u32`

Number of parallel jobs.

§`num_cpus: Option<u64>`

Available parallelism of the compilation environment.

§`profile: String`

Build profile name (e.g., “dev”, “release”).

§`rustc_version: String`

The rustc version (`1.23.4-beta.2`).

§`rustc_version_verbose: String`

The rustc verbose version information (the output of `rustc -vV`).

§`target_dir: PathBuf`

Target directory for build artifacts.

§`workspace_root: PathBuf`

Workspace root directory.

§

### ResolutionStarted

Emitted when resolving dependencies starts.

#### Fields

§`elapsed: f64`

Seconds elapsed from build start.

§

### ResolutionFinished

Emitted when resolving dependencies finishes.

#### Fields

§`elapsed: f64`

Seconds elapsed from build start.

§

### UnitGraphStarted

Emitted when unit graph generation starts.

#### Fields

§`elapsed: f64`

Seconds elapsed from build start.

§

### UnitGraphFinished

Emitted when unit graph generation finishes.

#### Fields

§`elapsed: f64`

Seconds elapsed from build start.

§

### UnitRegistered

Emitted when a compilation unit is registered in the unit graph, right before `LogMessage::UnitGraphFinished` that Cargo finalizes the unit graph.

#### Fields

§`package_id: PackageIdSpec`

Package ID specification.

§`target: Target`

Cargo target (lib, bin, example, etc.).

§`mode: CompileMode`

The compilation action this unit is for (check, build, test, etc.).

§`platform: String`

The target platform this unit builds for.

It is either a target triple the compiler accepts, or a file name with the `json` extension for a custom target.

§`index: UnitIndex`

Unit index for compact reference in subsequent events.

§`features: Vec<String>`

Enabled features.

§`requested: bool`

Whether this is requested to build by user directly, like via the `-p` flag or the default workspace members.

§`dependencies: Vec<UnitIndex>`

Unit indices that this unit depends on.

§

### UnitStarted

Emitted when a compilation unit starts.

#### Fields

§`index: UnitIndex`

Unit index from the associated unit-registered event.

§`elapsed: f64`

Seconds elapsed from build start.

§

### UnitRmetaFinished

Emitted when a section (e.g., rmeta, link) of the compilation unit finishes.

#### Fields

§`index: UnitIndex`

Unit index from the associated unit-registered event.

§`elapsed: f64`

Seconds elapsed from build start.

§`unblocked: Vec<UnitIndex>`

Unit indices that were unblocked by this rmeta completion.

§

### UnitSectionStarted

Emitted when a section (e.g., rmeta, link) of the compilation unit starts.

Requires `-Zsection-timings` to be enabled.

#### Fields

§`index: UnitIndex`

Unit index from the associated unit-registered event.

§`elapsed: f64`

Seconds elapsed from build start.

§`section: String`

Section name from rustc’s `-Zjson=timings` (e.g., “codegen”, “link”).

§

### UnitSectionFinished

Emitted when a section (e.g., rmeta, link) of the compilation unit finishes.

Requires `-Zsection-timings` to be enabled.

#### Fields

§`index: UnitIndex`

Unit index from the associated unit-registered event.

§`elapsed: f64`

Seconds elapsed from build start.

§`section: String`

Section name from rustc’s `-Zjson=timings` (e.g., “codegen”, “link”).

§

### UnitFinished

Emitted when a compilation unit finishes.

#### Fields

§`index: UnitIndex`

Unit index from the associated unit-registered event.

§`elapsed: f64`

Seconds elapsed from build start.

§`unblocked: Vec<UnitIndex>`

Unit indices that were unblocked by this completion.

§

### UnitFingerprint

Emitted when rebuild fingerprint information is determined for a unit.

#### Fields

§`index: UnitIndex`

Unit index from the associated unit-registered event.

§`status: FingerprintStatus`

Status of the rebuild detection fingerprint of this unit

§`cause: Option<DirtyReason>`

Reason why the unit is dirty and needs rebuilding.

## Implementations§

Source§

### impl LogMessage

Source

#### pub fn write_json_log<W: Write>( &self, writer: &mut W, run_id: &str, ) -> Result<()>

Serializes this message as a JSON log line directly to the writer.

## Trait Implementations§

Source§

### impl Clone for LogMessage

Source§

#### fn clone(&self) -> LogMessage

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from `source`. Read more
Source§

### impl<'de> Deserialize<'de> for LogMessage

Source§

#### fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

### impl Serialize for LogMessage

Source§

#### fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

## Auto Trait Implementations§

§

### impl Freeze for LogMessage

§

### impl RefUnwindSafe for LogMessage

§

### impl Send for LogMessage

§

### impl Sync for LogMessage

§

### impl Unpin for LogMessage

§

### impl UnsafeUnpin for LogMessage

§

### impl UnwindSafe for LogMessage

## 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> CloneToUninit for T
where T: Clone,

Source§

#### unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (`clone_to_uninit`)
Performs copy-assignment from `self` to `dest`. Read more
Source§

### impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

### impl<T> From<T> for T

Source§

#### fn from(t: T) -> T

Returns the argument unchanged.

§

### impl<T> Instrument for T

§

#### fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [`Span`], returning an `Instrumented` wrapper. Read more
§

#### fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current `Span`, returning an `Instrumented` wrapper. Read more
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> IntoEither for T

Source§

#### fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts `self` into a `Left` variant of `Either<Self, Self>` if `into_left` is `true`. Converts `self` into a `Right` variant of `Either<Self, Self>` otherwise. Read more
Source§

#### fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts `self` into a `Left` variant of `Either<Self, Self>` if `into_left(&self)` returns `true`. Converts `self` into a `Right` variant of `Either<Self, Self>` otherwise. Read more
§

### impl<T> Pointable for T

§

#### const ALIGN: usize

The alignment of pointer.
§

#### type Init = T

The type for initializers.
§

#### unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

#### unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

#### unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

#### unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

### impl<T> Same for T

Source§

#### type Output = T

Should always be `Self`
Source§

### impl<T> Serialize for T
where T: Serialize + ?Sized,

Source§

#### fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

Source§

#### fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

Source§

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

Source§

#### 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>,

Source§

#### 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>,

Source§

#### 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.
§

### impl<T> WithSubscriber for T

§

#### fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided `Subscriber` to this type, returning a [`WithDispatch`] wrapper. Read more
§

#### fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default `Subscriber` to this type, returning a [`WithDispatch`] wrapper. Read more

## 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: 336 bytes

Size for each variant:

- `BuildStarted`: 224 bytes
- `ResolutionStarted`: 16 bytes
- `ResolutionFinished`: 16 bytes
- `UnitGraphStarted`: 16 bytes
- `UnitGraphFinished`: 16 bytes
- `UnitRegistered`: 336 bytes
- `UnitStarted`: 24 bytes
- `UnitRmetaFinished`: 48 bytes
- `UnitSectionStarted`: 48 bytes
- `UnitSectionFinished`: 48 bytes
- `UnitFinished`: 48 bytes
- `UnitFingerprint`: 120 bytes