Output format: json

The json output format is intended to be used as a machine-readable output, to be interpreted by tooling, although humans may also use it, as it provides the most detailed output of all supported output formats.

As described on the output-formats page, cargo-msrv reports the status of the program via events. A processor transforms these events into their output-format. In case of the json output format, events are almost 1-on-1 serialized to json (there are a few exceptions), and then printed to stderr. Each json serialized event ends with a newline. Each line thus represents a single serialized event.

To use the json output format, run cargo-msrv with the --output-format json option. For example, if you want to find the MSRV, you could run cargo msrv find --output-format json.

In the next section, you can find a description of the common fields of events. The section thereafter gives an overview of each of the supported events, with for each event its event specific fields.

Events and scope

Cargo MSRV currently reports two types of events: unscoped and scoped events. Unscoped events report about an action on a certain point in time, while scoped events report about an action which took place over a period of time.

In the context of the json output format, an unscoped event will print a single json-line to the stderr, while a scoped event will print two json-lines to the stderr (one prior to starting the action, and one after the action has been completed).

Common fields on events

nameoptionalvaluesdescription
typenoIdentifies a specific event.
scopeyesA pair of events which mark the start and end of an action. Together these two individual events are called a scoped event.
scope.idnoA unique id to match up the two events marking the begin and end of an action. The current incremental nature is an implementation detail and not guaranteed.
scope.markerno"start" or "end"Whether the event marks the beginning or the end of the action

The type field can be used to identify a specific event.

The scope field is only present for scoped events. The start value (on the marker subfield) marks the start of a scoped event, while end marks the end of a scoped event.

List of events

Event: Meta

type: meta

description: Reports metadata about the currently running cargo-msrv program instance.

fields:

namedescription
instanceName of the running cargo-msrv program as defined on compile time. This will usually be cargo-msrv.
versionVersion of the running cargo-msrv program as defined on compile time.
sha_shortShort SHA hash of the git commit used to compile and build cargo-msrv.
target_tripleTarget triple of toolchain used to compile and build cargo-msrv.
cargo_featuresFeatures which were enabled during the compilation of cargo-msrv.
rustcVersion of rustc used to compile cargo-msrv.

example:

{
  "type": "meta",
  "instance": "cargo-msrv",
  "version": "0.15.1",
  "sha_short": "79582b6",
  "target_triple": "x86_64-pc-windows-msvc",
  "cargo_features": "default,rust_releases_dist_source",
  "rustc": "1.62.0"
}

Event: FetchIndex

type: fetch_index

description: Prior to determining the MSRV of a crate, we have to figure out which Rust versions are available. We obtain those using the rust-releases library. The FetchIndex event reports that the index is being fetched, and details which source is used.

fields:

namedescription
sourcePlace from where the available Rust releases are obtained

example:

{
  "type": "fetch_index",
  "source": "rust_changelog",
  "scope": "start"
}
{
  "type": "fetch_index",
  "source": "rust_changelog",
  "scope": "end"
}

Event: CheckToolchain

type: check_toolchain

description: The primary way for cargo-msrv to determine whether a given Rust toolchain is compatible with your crate, is by installing a toolchain and using it to check a crate for compatibility with this toolchain. The CheckToolchain event is wrapped around this process and notifies you about the start and end of this process. This event is called as a scoped event, and within it's scope, you'll find the following events: setup_toolchain, check_method and check_result, which are described in more detail below.

fields:

namedescription
toolchainThe toolchain to be located or installed
toolchain.versionThe Rust version of the toolchain
toolchain.targetThe target-triple of the toolchain

example:

{
  "type": "check_toolchain",
  "toolchain": {
    "version": "1.35.0",
    "target": "x86_64-pc-windows-msvc"
  },
  "scope": "start"
}
{
  "type": "check_toolchain",
  "toolchain": {
    "version": "1.35.0",
    "target": "x86_64-pc-windows-msvc"
  },
  "scope": "end"
}

Event: SetupToolchain

type: setup_toolchain

description: The primary way for cargo-msrv to determine whether a given Rust toolchain is compatible with your crate, is by installing a toolchain and using it to check a crate for compatibility with this toolchain. The SetupToolchain event reports about the process of locating or installing a given toolchain.

fields:

namedescription
toolchainThe toolchain to be located or installed
toolchain.versionThe Rust version of the toolchain
toolchain.targetThe target-triple of the toolchain

example:

{
  "type": "setup_toolchain",
  "toolchain": {
    "version": "1.47.0",
    "target": "x86_64-pc-windows-msvc"
  },
  "scope": "start"
}
{
  "type": "setup_toolchain",
  "toolchain": {
    "version": "1.47.0",
    "target": "x86_64-pc-windows-msvc"
  },
  "scope": "end"
}

Event: CheckMethod

type: check_method

description: Reports which method has been used to check whether a toolchain is compatible with a crate.

fields:

nameoptionalconditiondescription
toolchainnoThe toolchain to be located or installed
toolchain.versionnoThe Rust version of the toolchain
toolchain.targetnoThe target-triple of the toolchain
methodnoThe method used to check for compatibility
method.typenoThe type of method
method.argsnomethod.type = rustup_runThe arguments provided to rustup
method.pathyesmethod.type = rustup_runThe path provided to rustup, if any

example:

{
  "type": "check_method",
  "toolchain": {
    "version": "1.37.0",
    "target": "x86_64-pc-windows-msvc"
  },
  "method": {
    "rustup_run": {
      "args": [
        "1.37.0-x86_64-pc-windows-msvc",
        "cargo",
        "check"
      ],
      "path": "..\\air3\\"
    }
  }
}

Event: CheckResult

type: check_result

description: Reports the result of a cargo-msrv compatibility check.

fields:

nameoptionalconditiondescription
toolchainnoThe toolchain to be located or installed
toolchain.versionnoThe Rust version of the toolchain
toolchain.targetnoThe target-triple of the toolchain
is_compatiblenoBoolean value stating compatibility
erroryesis_compatible = falseError message of a failed compatibility check, if any

example:

{
  "type": "check_result",
  "toolchain": {
    "version": "1.38.0",
    "target": "x86_64-pc-windows-msvc"
  },
  "is_compatible": true
}
{
  "type": "check_result",
  "toolchain": {
    "version": "1.37.0",
    "target": "x86_64-pc-windows-msvc"
  },
  "is_compatible": false,
  "error": "error: failed to parse lock file at: .\\air3\\Cargo.lock\n\nCaused by:\ninvalid serialized PackageId for key `package.dependencies`\n"
}

Event: AuxiliaryOutput

type: auxiliary_output

description: Reports about additional output written by cargo-msrv when applicable. For example, if the --write-msrv or --write-toolchain-file flag is provided, the MSRV will be written to the Cargo manifest or the Rust toolchain file respectively. The act of writing this (additional) output is reported by this event.

fields:

nameoptionalconditiondescription
destinationnoThe destination of the auxiliary output
destination.typenoType of destination, currently only "file"
destination.pathnoif destination.type = filePath of the written or amended file
itemnoWhat kind of output is written
item.typenoType of output item
item.kindnoif item.type = msrvTo which field the MSRV was written in the Cargo manifest, "rust-version" or "metadata_fallback"
item.kindnoif item.type = toolchain_fileWhich toolchain file kind was written, "legacy" or "toml"

example:

{
  "type": "auxiliary_output",
  "destination": {
    "type": "file",
    "path": "..\\air3\\Cargo.toml"
  },
  "item": {
    "type": "msrv",
    "kind": "rust_version"
  }
}

Event: Progress

type: progress

description: Reports on the progress of an ongoing MSRV search.

fields:

nameoptionalconditiondescription
currentnoIndex of the currently running check into the sorted search space. Starts at 0.
search_space_sizenoThe size of the search space.
iterationnoHow many iterations have been completed, plus one for the currently running iteration. Starts at 1.

Event: SubcommandInit

type: subcommand_init

description: Reports the start of a subcommand flow.

fields:

nameoptionalconditiondescription
subcommand_idnoA name identifying the subcommand

Event: SubcommandResult

type: subcommand_result

description: Reports the outcome of a subcommand flow.

fields:

nameoptionalconditiondescription
subcommand_idnoA name identifying the subcommand
resultnosubcommand_id = findResult of find command
result.successnosubcommand_id = findWhether the MSRV was found or not
result.versionnosubcommand_id = find and result.success = trueThe Minimum Supported Rust Version (MSRV)
resultnosubcommand_id = listResult of list command
result.variantnosubcommand_id = listType of list output. Either direct-deps or ordered-by-msrv.
result.listnosubcommand_id = list and result.variant = direct-depsList of direct dependencies of the selected crate
result.list.namenosubcommand_id = list and result.variant = direct-depsName of the crate
result.list.versionnosubcommand_id = list and result.variant = direct-depsVersion of the crate
result.list.msrvnosubcommand_id = list and result.variant = direct-depsMSRV of the crate if any, null if the MSRV is not set
result.list.dependenciesnosubcommand_id = list and result.variant = direct-depsDependencies of the given crate, relevant for the MSRV
result.listnosubcommand_id = list and result.variant = ordered-by-msrvList of all dependencies relevant for the MSRV, categorised by their MSRV
result.list.msrvnosubcommand_id = list and result.variant = ordered-by-msrvA value for the MSRV specified by at least one crate
result.list.dependenciesnosubcommand_id = list and result.variant = ordered-by-msrvList of dependencies which specified the same value for the MSRV
resultnosubcommand_id = setResult of set command
result.versionnosubcommand_id = setWhich version was set as MSRV
result.manifest_pathnosubcommand_id = setRelative path of file where the MSRV was written to
resultnosubcommand_id = showResult of show command
result.versionnosubcommand_id = showMSRV as set for the given crate
result.manifest_pathnosubcommand_id = showRelative path of file where the MSRV was read from
resultnosubcommand_id = verifyResult of verify command
result.toolchainnosubcommand_id = verifyThe toolchain to be located or installed
result.toolchain.versionnosubcommand_id = verifyThe Rust version of the verified toolchain
result.toolchain.targetnosubcommand_id = verifyThe target-triple of the verified toolchain
result.is_compatiblenosubcommand_id = verifyBoolean value stating compatibility
result.erroryessubcommand_id = verify and result.is_compatible = falseError message of a failed verify check, if any

example 1: find

{
  "type": "subcommand_result",
  "subcommand_id": "find",
  "result": {
    "version": "1.38.0",
    "success": true
  }
}

example 2: list with direct-deps

{
  "type": "subcommand_result",
  "subcommand_id": "list",
  "result": {
    "variant": "direct-deps",
    "list": [
      {
        "name": "crossbeam-channel",
        "version": "0.5.4",
        "msrv": "1.36.0",
        "dependencies": [
          "cfg-if",
          "crossbeam-utils",
          "num_cpus",
          "rand",
          "signal-hook"
        ]
      }
    ]
  }
}

Formatted:

{
  "type": "subcommand_result",
  "subcommand_id": "list",
  "result": {
    "variant": "direct-deps",
    "list": [
      {
        "name": "crossbeam-channel",
        "version": "0.5.4",
        "msrv": "1.36.0",
        "dependencies": [
          "cfg-if",
          "crossbeam-utils",
          "num_cpus",
          "rand",
          "signal-hook"
        ]
      }
    ]
  }
}

example 3: list with ordered-by-msrv

{
  "type": "subcommand_result",
  "subcommand_id": "list",
  "result": {
    "variant": "ordered-by-msrv",
    "list": [
      {
        "msrv": "1.38.0",
        "dependencies": [
          "storyteller"
        ]
      },
      {
        "msrv": "1.36.0",
        "dependencies": [
          "crossbeam-channel",
          "crossbeam-utils"
        ]
      },
      {
        "msrv": null,
        "dependencies": [
          "cfg-if",
          "lazy_static"
        ]
      }
    ]
  }
}

Formatted:

{
  "type": "subcommand_result",
  "subcommand_id": "list",
  "result": {
    "variant": "ordered-by-msrv",
    "list": [
      {
        "msrv": "1.38.0",
        "dependencies": [
          "storyteller"
        ]
      },
      {
        "msrv": "1.36.0",
        "dependencies": [
          "crossbeam-channel",
          "crossbeam-utils"
        ]
      },
      {
        "msrv": null,
        "dependencies": [
          "cfg-if",
          "lazy_static"
        ]
      }
    ]
  }
}

example 5: set:

{
  "type": "subcommand_result",
  "subcommand_id": "set",
  "result": {
    "version": "1.38.0",
    "manifest_path": "..\\air3\\Cargo.toml"
  }
}

example 6: show:

{
  "type": "subcommand_result",
  "subcommand_id": "show",
  "result": {
    "version": "1.38.0",
    "manifest_path": "..\\air3\\Cargo.toml"
  }
}

example 7: verify:

{
  "type": "subcommand_result",
  "subcommand_id": "verify",
  "result": {
    "toolchain": {
      "version": "1.38.0",
      "target": "x86_64-pc-windows-msvc"
    },
    "is_compatible": true
  }
}

Event: TerminateWithFailure

type: terminate_with_failure

description: Reports about failure which led to program termination with a non-zero exit code.

fields:

nameoptionaldescription
reasonnoReason of failure
reason.descriptionnoDescribes why cargo-msrv will terminate with a non-zero exit code

example:

{
  "type": "terminate_with_failure",
  "reason": {
    "description": "MSRV was not specified in Cargo manifest at '..\\air\\Cargo.toml'"
  }
}