defineCargoPolicy
Call Signature
Section titled “Call Signature”defineCargoPolicy<
C>(args):FilePolicyDefinition<C> &object
Defined in: policyDefiners/defineCargoPolicy.ts:103
Define a repo policy for Cargo.toml files.
Type Parameters
Section titled “Type Parameters”C = void
Parameters
Section titled “Parameters”DefineCargoPolicyArgs<C> & object
Policy metadata, parsed-TOML handler, and optional defaults.
Returns
Section titled “Returns”FilePolicyDefinition<C> & object
A file policy that reads and parses matching Cargo.toml files.
Remarks
Section titled “Remarks”This is a helper function that creates a policy pre-configured to match Cargo.toml files. The handler receives the parsed TOML content.
Example
Section titled “Example”const MyCargoPolicy = defineCargoPolicy({ name: "MyCargoPolicy", description: "Ensures Cargo.toml has required fields", handler: async (toml, { file }) => { const pkg = toml.package as Record<string, unknown> | undefined; if (!pkg?.name) { return [{ message: "Missing package name" }]; } return []; },});Call Signature
Section titled “Call Signature”defineCargoPolicy<
C>(args):FilePolicyDefinition<C> &object
Defined in: policyDefiners/defineCargoPolicy.ts:107
Define a Cargo policy that requires explicit configuration.
Type Parameters
Section titled “Type Parameters”C = void
Parameters
Section titled “Parameters”DefineCargoPolicyArgs<C> & object
Returns
Section titled “Returns”FilePolicyDefinition<C> & object
Call Signature
Section titled “Call Signature”defineCargoPolicy<
C>(args):FilePolicyDefinition<C>
Defined in: policyDefiners/defineCargoPolicy.ts:111
Define a Cargo policy with optional configuration.
Type Parameters
Section titled “Type Parameters”C = void