Shadow0482 commited on
Commit
bae2359
·
verified ·
1 Parent(s): 06ecacf

Add Rust question/code dataset

Browse files
Files changed (2) hide show
  1. README.md +76 -0
  2. data/train-00000-of-00001.parquet +3 -0
README.md ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ task_categories:
4
+ - text-generation
5
+ language:
6
+ - en
7
+ tags:
8
+ - rust
9
+ - code
10
+ - instruction-tuning
11
+ - synthetic
12
+ size_categories:
13
+ - n<1K
14
+ configs:
15
+ - config_name: default
16
+ data_files:
17
+ - split: train
18
+ path: data/train-*.parquet
19
+ ---
20
+
21
+ # Rust code instruction dataset
22
+
23
+ 126 pairs of **(question, real Rust code)** built from 1 open-source GitHub repositories.
24
+
25
+ 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.
26
+
27
+ ## Source repositories
28
+
29
+ | repository | commit | license | files | chunks | rows |
30
+ |---|---|---|---:|---:|---:|
31
+ | [bee-san/RustScan](https://github.com/bee-san/RustScan) | `937903340a` | GPL-3.0-only | 14 | 127 | 126 |
32
+
33
+ ## Rows by kind
34
+
35
+ | kind | rows |
36
+ |---|---:|
37
+ | function | 51 |
38
+ | method | 48 |
39
+ | struct | 17 |
40
+ | enum | 5 |
41
+ | macro | 4 |
42
+ | trait | 1 |
43
+
44
+ ## Example
45
+
46
+ **Question**
47
+
48
+ > I need a function called `old_payload_for_port` that retrieves a static byte slice payload associated with a given port from a predefined mapping. The mapping is a static `BTreeMap` where each key is a `Vec<u16>` representing valid ports, and each value is a `Vec<u8>` payload. The function should accept a `&'static BTreeMap<Vec<u16>, Vec<u8>>` and a `u16` port, and return a `&'static [u8]`. It should iterate through the map entries and return the payload of the first entry whose port list contains the given port. If no entry matches, it should return an empty static byte slice.
49
+
50
+ **Answer** (`bee-san/RustScan` - `benches/benchmark_helpers.rs`)
51
+
52
+ ```rust
53
+ fn old_payload_for_port(udp_map: &'static BTreeMap<Vec<u16>, Vec<u8>>, port: u16) -> &'static [u8] {
54
+ let mut payload: &'static [u8] = b"";
55
+ for (ports, value) in udp_map.iter() {
56
+ if ports.contains(&port) {
57
+ payload = value.as_slice();
58
+ }
59
+ }
60
+ payload
61
+ }
62
+ ```
63
+
64
+ ## Usage
65
+
66
+ ```python
67
+ from datasets import load_dataset
68
+
69
+ dataset = load_dataset("Shadow0482/rust", split="train")
70
+ print(dataset[0]["question"])
71
+ print(dataset[0]["answer"])
72
+ ```
73
+
74
+ ## License and attribution
75
+
76
+ 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.
data/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a15ddeb083a9d6b6a4f6b3ab77c10ae04404520a9594469bd44cc0f786e6316f
3
+ size 71990