Datasets:
Download README.md from Shadow0482/rust-r1: direct link, hf CLI and curl.
- Browser
- Download file 2.43 kB
-
https://huggingface.co/datasets/Shadow0482/rust-r1/resolve/main/README.md
- Command line
-
hf download hf://datasets/Shadow0482/rust-r1/README.md
-
curl -L -o README.md https://huggingface.co/datasets/Shadow0482/rust-r1/resolve/main/README.md
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
126 pairs of (question, real Rust code) built from 1 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 |
|---|---|---|---|---|---|
| bee-san/RustScan | 937903340a |
GPL-3.0-only | 14 | 127 | 126 |
Rows by kind
| kind | rows |
|---|---|
| function | 51 |
| method | 48 |
| struct | 17 |
| enum | 5 |
| macro | 4 |
| trait | 1 |
Example
Question
I need a function called
old_payload_for_portthat retrieves a static byte slice payload associated with a given port from a predefined mapping. The mapping is a staticBTreeMapwhere each key is aVec<u16>representing valid ports, and each value is aVec<u8>payload. The function should accept a&'static BTreeMap<Vec<u16>, Vec<u8>>and au16port, 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.
Answer (bee-san/RustScan - benches/benchmark_helpers.rs)
fn old_payload_for_port(udp_map: &'static BTreeMap<Vec<u16>, Vec<u8>>, port: u16) -> &'static [u8] {
let mut payload: &'static [u8] = b"";
for (ports, value) in udp_map.iter() {
if ports.contains(&port) {
payload = value.as_slice();
}
}
payload
}
Usage
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.