UNPKG

@codama/renderers-rust

Version:

Renders Rust clients for your programs

39 lines 1.79 kB
import { AccountNode, DefinedTypeNode, InstructionNode } from '@codama/nodes'; import { ImportMap } from '../ImportMap'; export type TraitOptions = { /** The default traits to implement for all types. */ baseDefaults?: string[]; /** * The default traits to implement for data enums only — on top of the base defaults. * Data enums are enums with at least one non-unit variant. */ dataEnumDefaults?: string[]; /** * The mapping of feature flags to traits. * For each entry, the traits will be rendered within a * `#[cfg_attr(feature = "feature_name", derive(Traits))]` attribute. */ featureFlags?: Record<string, string[]>; /** The complete trait overrides of specific types. */ overrides?: Record<string, string[]>; /** * The default traits to implement for scalar enums only — on top of the base defaults. * Scalar enums are enums with no variants or only unit variants. */ scalarEnumDefaults?: string[]; /** The default traits to implement for structs only — on top of the base defaults. */ structDefaults?: string[]; /** Whether or not to use the fully qualified name for traits, instead of importing them. */ useFullyQualifiedName?: boolean; }; export declare const DEFAULT_TRAIT_OPTIONS: Required<TraitOptions>; export type GetTraitsFromNodeFunction = (node: AccountNode | DefinedTypeNode | InstructionNode) => { imports: ImportMap; render: string; }; export declare function getTraitsFromNodeFactory(options?: TraitOptions): GetTraitsFromNodeFunction; export declare function getTraitsFromNode(node: AccountNode | DefinedTypeNode | InstructionNode, userOptions?: TraitOptions): { imports: ImportMap; render: string; }; //# sourceMappingURL=traitOptions.d.ts.map