File size: 3,321 Bytes
df98c44
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
---

license: other
task_categories:
- text-generation
language:
- en
tags:
- rust
- code
- instruction-tuning
- synthetic
size_categories:
- n<1K
configs:
- config_name: default
  data_files:
  - split: train
    path: data/train-*.parquet
---


# Rust code instruction dataset

410 pairs of **(question, real Rust code)** built from 6 open-source GitHub repositories.

Each `answer` is original Rust source. Each `question` was written by `nvidia/nemotron-3.5-lightning-30b-a3b` from the code context; the model does not generate the answer.

## Source repositories

| repository | commit | license | files | chunks | rows |
|---|---|---|---:|---:|---:|
| [TheAlgorithms/Rust](https://github.com/TheAlgorithms/Rust) | `fed66cb0c7` | MIT | 421 | 174 | 163 |
| [reyamira/models](https://github.com/reyamira/models) | `73997bf31e` | MIT | 78 | 29 | 23 |
| [AreevAI/flowcat](https://github.com/AreevAI/flowcat) | `9eb2999c33` | Apache-2.0 | 192 | 88 | 66 |
| [cortex/ripasso](https://github.com/cortex/ripasso) | `25f855dfc3` | GPL-3.0-only | 22 | 21 | 18 |
| [brentongunning/rust-sv](https://github.com/brentongunning/rust-sv) | `f2c9e939b3` | MIT | 54 | 22 | 21 |
| [lightningdevkit/rust-lightning](https://github.com/lightningdevkit/rust-lightning) | `48e8d4745e` | Apache-2.0 OR MIT | 257 | 138 | 119 |

## Rows by kind

| kind | rows |
|---|---:|
| file | 410 |

## Example

**Question**

> I need a Rust module that declares several backtracking algorithm submodules and re-exports their public functions. The module should define submodules named all_combination_of_size_k, graph_coloring, hamiltonian_cycle, knight_tour, n_queens, parentheses_generator, permutations, rat_in_maze, subset_sum, and sudoku. It must re-export exactly these functions with these exact names: generate_all_combinations, generate_colorings, find_hamiltonian_cycle, find_knight_tour, n_queens_solver, generate_parentheses, permute, find_path_in_maze, has_subset_with_sum, and sudoku_solver. Please generate the module declarations and pub use statements that match this structure.



**Answer** (`TheAlgorithms/Rust` - `src/backtracking/mod.rs`)



```rust

mod all_combination_of_size_k;

mod graph_coloring;
mod hamiltonian_cycle;

mod knight_tour;
mod n_queens;

mod parentheses_generator;
mod permutations;
mod rat_in_maze;
mod subset_sum;

mod sudoku;



pub use all_combination_of_size_k::generate_all_combinations;

pub use graph_coloring::generate_colorings;

pub use hamiltonian_cycle::find_hamiltonian_cycle;
pub use knight_tour::find_knight_tour;

pub use n_queens::n_queens_solver;
pub use parentheses_generator::generate_parentheses;
pub use permutations::permute;
pub use rat_in_maze::find_path_in_maze;

pub use subset_sum::has_subset_with_sum;

pub use sudoku::sudoku_solver;
```



## Usage



```python

from datasets import load_dataset



dataset = load_dataset("Shadow0482/rust", split="train")

print(dataset[0]["question"])

print(dataset[0]["answer"])

```

## License and attribution

Code in `answer` remains under the license of the source repository shown in the `license` and `repo_url` columns. Follow that license when redistributing or training on the data. The questions are synthetic; follow the terms of the model provider used to create them.