Class: Makit::Cli::Generators::Templates::Rust::CargoToml

Inherits:
Object
  • Object
show all
Defined in:
lib/makit/cli/generators/templates/rust_templates.rb

Overview

Template for generating Cargo.toml configuration file

This template creates the main configuration file for Rust projects, including package metadata and dependencies configuration.

Instance Method Summary collapse

Constructor Details

#initialize(project_name) ⇒ CargoToml

Initialize the Cargo.toml template

Parameters:

  • project_name (String)

    Name of the Rust project



17
18
19
# File 'lib/makit/cli/generators/templates/rust_templates.rb', line 17

def initialize(project_name)
  @project_name = project_name
end

Instance Method Details

#renderString

Render the Cargo.toml file content

Returns:

  • (String)

    TOML configuration content for the Rust project



24
25
26
27
28
29
30
31
32
33
# File 'lib/makit/cli/generators/templates/rust_templates.rb', line 24

def render
  <<~TOML
    [package]
    name = "#{@project_name}"
    version = "0.1.0"
    edition = "2021"

    [dependencies]
  TOML
end