Dataset Preview
Duplicate
The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
The dataset generation failed
Error code:   DatasetGenerationError
Exception:    CastError
Message:      Couldn't cast
messages: list<item: struct<role: string, content: string>>
  child 0, item: struct<role: string, content: string>
      child 0, role: string
      child 1, content: string
task_category: string
crate_name: string
test: string
source_dataset: string
source_license: string
record_id: string
split: string
output_data: null
input_data: struct<text: string>
  child 0, text: string
to
{'task_category': Value('string'), 'crate_name': Value('string'), 'input_data': {'text': Value('string')}, 'output_data': Json(decode=True), 'test': Value('string'), 'source_dataset': Value('string'), 'source_license': Value('string'), 'record_id': Value('string'), 'split': Value('string')}
because column names don't match
Traceback:    Traceback (most recent call last):
                File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1835, in _prepare_split_single
                  for key, table in generator:
                                    ^^^^^^^^^
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 621, in wrapped
                  for item in generator(*args, **kwargs):
                              ~~~~~~~~~^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/packaged_modules/json/json.py", line 361, in _generate_tables
                  self._cast_table(pa_table, json_field_paths=json_field_paths),
                  ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/packaged_modules/json/json.py", line 132, in _cast_table
                  pa_table = table_cast(pa_table, self.info.features.arrow_schema)
                File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2381, in table_cast
                  return cast_table_to_schema(table, schema)
                File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2309, in cast_table_to_schema
                  raise CastError(
                  ...<3 lines>...
                  )
              datasets.table.CastError: Couldn't cast
              messages: list<item: struct<role: string, content: string>>
                child 0, item: struct<role: string, content: string>
                    child 0, role: string
                    child 1, content: string
              task_category: string
              crate_name: string
              test: string
              source_dataset: string
              source_license: string
              record_id: string
              split: string
              output_data: null
              input_data: struct<text: string>
                child 0, text: string
              to
              {'task_category': Value('string'), 'crate_name': Value('string'), 'input_data': {'text': Value('string')}, 'output_data': Json(decode=True), 'test': Value('string'), 'source_dataset': Value('string'), 'source_license': Value('string'), 'record_id': Value('string'), 'split': Value('string')}
              because column names don't match
              
              The above exception was the direct cause of the following exception:
              
              Traceback (most recent call last):
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1379, in compute_config_parquet_and_info_response
                  parquet_operations, partial, estimated_dataset_info = stream_convert_to_parquet(
                                                                        ~~~~~~~~~~~~~~~~~~~~~~~~~^
                      builder, max_dataset_size_bytes=max_dataset_size_bytes
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                  )
                  ^
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 956, in stream_convert_to_parquet
                  builder._prepare_split(split_generator=splits_generators[split], file_format="parquet")
                  ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1702, in _prepare_split
                  for job_id, done, content in self._prepare_split_single(
                                               ~~~~~~~~~~~~~~~~~~~~~~~~~~^
                      gen_kwargs=gen_kwargs, job_id=job_id, **_prepare_split_args
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                  ):
                  ^
                File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1887, in _prepare_split_single
                  raise DatasetGenerationError("An error occurred while generating the dataset") from e
              datasets.exceptions.DatasetGenerationError: An error occurred while generating the dataset

Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.

task_category
string
crate_name
string
input_data
dict
output_data
unknown
test
string
source_dataset
string
source_license
string
record_id
string
split
string
comment_generation
datafusion-datasource-csv
{ "text": "{'code': 'fn open<R: Read>(&self, reader: R) -> Result<csv::Reader<R>> {\\n Ok(self.builder().build(reader)?)\\n}', 'code_context': 'use std::io::Read;\\nuse std::sync::Arc;\\nuse arrow::csv;\\nuse arrow::csv::ReaderBuilder;\\nuse arrow::datatypes::SchemaRef;\\nuse datafusion_common::Result;\\n\\n#[deri...
{ "commented_code": "fn open<R: Read>(&self, reader: R) -> Result<csv::Reader<R>> { // Open a CSV reader with the configured options\n Ok(self.builder().build(reader)?)\n}" }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
1b27925decbdef284cefa53f254573f10494767bc662574c537bda99bf06b96d
train
comment_generation
datafusion-datasource-csv
{ "text": "{'code': 'pub fn with_has_header(mut self, has_header: bool) -> Self {\\n self.options.has_header = Some(has_header);\\n self\\n}', 'code_context': 'use datafusion_common::config::CsvOptions;\\n\\n#[derive(Default, Clone)]\\npub struct CsvOptions {\\n pub has_header: Option<bool>,\\n // other f...
{ "commented_code": "pub fn with_has_header(mut self, has_header: bool) -> Self { // Specify whether CSV files include a header row\n self.options.has_header = Some(has_header);\n self\n}" }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
be54187aebbc86486edbf4f6a5a51b3930a69f77c061eb9c2a0738e701db89ec
train
code_generation
async-stream
{ "text": "{'title': 'Filter and Transform Incoming TCP Connections', 'description': 'A developer is building a TCP server that should only accept connections from allowed IP addresses and then wrap each accepted socket into a higher‑level protocol handler. The filtering and construction are asynchronous, so an async...
{ "code": "async fn accepted_handlers(listener: TcpListener) -> impl Stream<Item = Result<MyProtocolHandler, std::io::Error>> {\n stream! {\n while let Ok((socket, _)) = listener.accept().await {\n if is_allowed(&socket.peer_addr()?) {\n let handler = MyProtocolHandler::new(socket)...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
cc10383f0eec8913b04f345ad1872bb42e58948d5ab67971efbb65e254f21bb3
train
code_generation
async-stream
{ "text": "{'title': 'Sequentially Merge Two Streams', 'description': 'A developer has two streams producing the same item type and wants a new stream that yields all items from the first stream followed by all items from the second stream.', 'code_context': 'use async_stream::stream;\\nuse futures_core::stream::Stre...
{ "code": "fn concat_streams<S1, S2, T>(s1: S1, s2: S2) -> impl Stream<Item = T>\nwhere\n S1: Stream<Item = T> + Unpin,\n S2: Stream<Item = T> + Unpin,\n{\n stream! {\n let mut s1 = s1;\n let mut s2 = s2;\n while let Some(item) = s1.next().await {\n yield item;\n }\n ...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
a407342716b190ae0e2c56e470397681f22a1bae67a16565d7f5059b5f13f2bf
train
bug_detection
ratatui-macros
{ "text": "{'buggy_code': 'constraints![ == 1, == 10%, == 2; 4]', 'code_context': 'use ratatui_core::layout::Constraint;\\nuse ratatui_core::style::Modifier;\\nuse ratatui_macros::{constraints, span};\\n\\nfn main() {\\n let [a, b] = constraints![\\n == 1/2,\\n == 2\\n ];\\n assert_eq!(a, Const...
{ "fixed_code": "constraints![ == 1, == 10%, == 2; 4 ]", "bug_description": "The macro's parser expects a trailing comma after a repetition clause; without it the macro mis‑parses the list and yields the wrong number of constraints. Adding the comma satisfies the parser." }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
fbeffaae3ba462db694a66494561439321390278ed16989a683a41902436786d
train
code_generation
async-stream-impl
{ "text": "{'title': 'Collect an asynchronous stream into a Vec', 'description': 'A developer needs an async helper that consumes a stream and returns a `Vec` containing all yielded items. This is useful for testing or when the full collection of results is required.', 'code_context': 'use futures_util::stream::Strea...
{ "code": "async fn collect_to_vec<S, T>(mut stream: S) -> Vec<T>\nwhere\n S: Stream<Item = T> + Unpin,\n T: Unpin,\n{\n let mut vec = Vec::new();\n while let Some(item) = stream.next().await {\n vec.push(item);\n }\n vec\n}" }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
1dfdf02c0e76807af7982c46628fbd31a0cb93d64b91cab1ed5774c9a716a9f3
train
comment_generation
slab
{ "text": "{'code': 'let key = slab.vacant_entry().key();', 'code_context': 'use slab::Slab;\\n\\nfn example() {\\n let mut slab = Slab::new();\\n}'}" }
{ "commented_code": "let key = slab.vacant_entry().key(); // Get the key for the next vacant entry" }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
602081e5582f81f12a3f2f5332acce83da0294b78f6fbbe70e7f7cab066ae182
train
comment_generation
slab
{ "text": "{'code': 'if key >= entries_cap { return Err(GetDisjointMutError::IndexOutOfBounds); }', 'code_context': 'use slab::GetDisjointMutError;\\n\\nfn example(key: usize, entries_cap: usize) -> Result<(), GetDisjointMutError> {\\n // snippet will be placed here\\n Ok(())\\n}'}" }
{ "commented_code": "if key >= entries_cap { return Err(GetDisjointMutError::IndexOutOfBounds); // Key is out of bounds }" }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
9aebfe90a601a355672d079309332441006260bc09cce1c28179446dfe58a465
train
comment_generation
slab
{ "text": "{'code': 'slab.entries[key] = Entry::Occupied(value);', 'code_context': 'use std::vec::Vec;\\n\\nenum Entry<T> {\\n Vacant(usize),\\n Occupied(T),\\n}\\n\\nstruct Slab<T> {\\n entries: Vec<Entry<T>>,\\n}'}" }
{ "commented_code": "slab.entries[key] = Entry::Occupied(value); // Replace existing entry or insert new occupied value" }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
09eec38c40e4d8c74b6ff57e27e8bd96c6651a18c6207a1a6666dc1bfc1679a7
train
comment_generation
slab
{ "text": "{'code': 'self.entries.push(Entry::Occupied(value));', 'code_context': 'use std::vec::Vec;\\n\\nenum Entry<T> {\\n Vacant(usize),\\n Occupied(T),\\n}\\n\\nstruct Slab<T> {\\n entries: Vec<Entry<T>>,\\n}'}" }
{ "commented_code": "self.entries.push(Entry::Occupied(value)); // Insert the occupied entry at the end" }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
0990b4b29903c5cb1824340cae65884abb76c9a4d4efb7e8242a7b92312ddf50
train
comment_generation
difflib
{ "text": "{'code': 'let mut res: Vec<(f32, &str)> = Vec::new();', 'code_context': 'pub fn get_close_matches<\\'a>(word: &str, possibilities: Vec<&\\'a str>, n: usize, cutoff: f32) -> Vec<&\\'a str> {\\n if !(0.0 <= cutoff && cutoff <= 1.0) {\\n panic!(\"Cutoff must be greater than 0.0 and lower than 1.0\")...
{ "commented_code": "let mut res: Vec<(f32, &str)> = Vec::new(); // Initialize a vector to store matches with their similarity scores" }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
170cf3b0e9c633c80528e2ee987ab00a90aa1a2bf5373a08cf7784d878262a50
train
comment_generation
difflib
{ "text": "{'code': 'res.push(format!(\"{} {}\", tag, s))', 'code_context': 'fn dump(&self, tag: &str, sequence: &[&str], start: usize, end: usize) -> Vec<String> {\\n let mut res = Vec::new();\\n for i in start..end {\\n if let Some(s) = sequence.get(i) {\\n res.push(format!(\"{} {}\", tag, s...
{ "commented_code": "res.push(format!(\"{} {}\", tag, s)); // Append a formatted line prefixed with its tag to the result vector" }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
6112cba84f767796d97a2fae1a5efd67c36c89bde453345baf5fb91d4defff2d
train
comment_generation
difflib
{ "text": "{'code': 'let mut s = format!(\"- {}\", first_line);', 'code_context': 'fn qformat(\\n &self,\\n first_line: &str,\\n second_line: &str,\\n first_tags: &str,\\n second_tags: &str,\\n) -> Vec<String> {\\n let mut res = Vec::new();\\n let mut first_tags = first_tags;\\n let mut second...
{ "commented_code": "let mut s = format!(\"- {}\", first_line); // Prefix the first line with a minus sign to indicate deletion" }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
d3670b5c7f523486fcbb613024b720e62c8c5c7becddf2558f9d1f647a5dc5f4
train
code_review
crossterm_winapi
{ "text": "{'code_before': 'let handle = *out_put_handle;\\nlet handle = unsafe { Handle::from_raw(handle) };', 'code_context': 'use std::sync::Arc;\\nuse winapi::um::winnt::HANDLE;\\n\\n#[derive(Clone)]\\npub struct Handle {\\n handle: Arc<HANDLE>,\\n}\\n\\nimpl Handle {\\n pub unsafe fn from_raw(handle: HANDL...
{ "code_after": "let handle = unsafe { Handle::from_raw(*out_put_handle) };", "review_comment": "The revised version removes the unnecessary intermediate variable and combines the dereference with the unsafe conversion into a single line. This reduces verbosity and the chance of mistakes while preserving the origin...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
c2bd9fd350588e730b55b9c5683c6c281c4e6d5a4832b882e6f283db28b4495d
train
code_review
crossterm_winapi
{ "text": "{'code_before': 'let attrs = csbi.attributes();\\nlet fg_color = attrs & 0x0007;\\nlet bg_color = attrs & 0x0070;\\nlet mut color = BLUE_FOREGROUND | bg_color;\\nif (attrs & 0x0080 as u16) != 0 {\\n color = color | 0x0080 as u16;\\n}', 'code_context': 'pub struct ScreenBufferInfo {\\n attributes: u16...
{ "code_after": "let attrs = csbi.attributes();\nlet fg_color = attrs & 0x0007;\nlet bg_color = attrs & 0x0070;\nlet mut color = BLUE_FOREGROUND | bg_color;\nif (attrs & 0x0080) != 0 {\n color |= 0x0080;\n}", "review_comment": "By using the `|=` operator and removing unnecessary casts, the code becomes shorter a...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
40442ffd75d6db75e919dabc5064a194d77848dc5a4d03b205138b31c6230e6f
train
code_generation
libp2p-tls
{ "text": "{'title': 'Check if a libp2p TLS certificate is currently valid', 'description': 'Before using a certificate for authentication, a developer wants to verify that its validity period includes the current time, ensuring the certificate has not expired or is not yet valid.', 'code_context': 'use libp2p_tls::c...
{ "code": "pub fn is_certificate_currently_valid(cert: &rustls::pki_types::CertificateDer) -> Result<bool, libp2p_tls::certificate::ParseError> {\n let parsed = libp2p_tls::certificate::parse(cert)?;\n Ok(parsed.certificate.validity().is_valid())\n}" }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
d69130a51502c0215c32f22dca2abece1485a890803b0d249e04e7a7ecd42ce7
train
code_generation
libp2p-tls
{ "text": "{'title': 'Validate a TLS certificate against an expected PeerId and supported signature scheme', 'description': 'A developer wants to ensure that a received certificate both belongs to a specific peer and uses a signature scheme that the libp2p implementation supports. This guards against man‑in‑the‑middl...
{ "code": "pub fn validate_certificate(\n cert: &rustls::pki_types::CertificateDer,\n expected_peer: &libp2p_identity::PeerId,\n) -> Result<(), libp2p_tls::certificate::ParseError> {\n let parsed = libp2p_tls::certificate::parse(cert)?;\n if parsed.peer_id() != *expected_peer {\n return Err(libp2p_...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
fcdd8bc73bb6e95e23a49e7231267f49cda670bc8d05f15f62ff32731d232ede
train
docstring_generation
libp2p-webrtc-utils
{ "text": "{'code': 'pub fn parse_webrtc_dial_addr(addr: &Multiaddr) -> Option<(SocketAddr, Fingerprint)> {\\n let mut iter = addr.iter();\\n\\n let ip = match iter.next()? {\\n Protocol::Ip4(ip) => IpAddr::from(ip),\\n Protocol::Ip6(ip) => IpAddr::from(ip),\\n _ => return None,\\n };\\n...
{ "docstring": "/// Parses a WebRTC multiaddr into a socket address and certificate fingerprint for dialing.\\n///\\n/// Expects a multiaddr in the format: `/ip4/<ip>/udp/<port>/webrtc-direct/certhash/<hash>[/p2p/<peer-id>]`\\n/// or `/ip6/<ip>/udp/<port>/webrtc-direct/certhash/<hash>[/p2p/<peer-id>]`\\n///\\n/// # A...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
dd4795185178012a0de460469646d3ed66588adb02a19ffb65b4bf6c6c38c0d2
train
docstring_generation
libp2p-webrtc-utils
{ "text": "{'code': 'pub fn render_description(\\n description: &str,\\n addr: SocketAddr,\\n fingerprint: Fingerprint,\\n ufrag: &str,\\n) -> String {\\n let mut tt = TinyTemplate::new();\\n tt.add_template(\"description\", description).unwrap();\\n\\n let context = DescriptionContext {\\n ...
{ "docstring": "/// Renders a description template with ICE connection parameters.\\n///\\n/// Takes a template string and populates it with connection details including\\n/// IP address information, fingerprint data, and authentication credentials.\\n///\\n/// # Arguments\\n///\\n/// * `description` - The template s...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
d8bd65b2421ff97f8f04feae918a72d6407d49f0686f8a87905466110d61e61f
train
bug_detection
libp2p-noise
{ "text": "{'buggy_code': 'impl<T: AsyncWrite + Unpin> AsyncWrite for Output<T> {\\n fn poll_write(\\n self: Pin<&mut Self>,\\n cx: &mut Context<\\'_>,\\n buf: &[u8],\\n ) -> Poll<io::Result<usize>> {\\n let this = Pin::into_inner(self);\\n let mut io = Pin::new(&mut this.io);...
{ "fixed_code": "impl<T: AsyncWrite + Unpin> AsyncWrite for Output<T> {\n fn poll_write(\n self: Pin<&mut Self>,\n cx: &mut Context<'_>,\n buf: &[u8],\n ) -> Poll<io::Result<usize>> {\n let this = Pin::into_inner(self);\n let mut io = Pin::new(&mut this.io);\n let frame...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
eb03ad1f7b1c2551fa56b0059090d4740b084a530f7982434a9bbb124040895e
train
docstring_generation
serde-value
{ "text": "{'code': 'pub enum Value {\\n Bool(bool),\\n\\n U8(u8),\\n U16(u16),\\n U32(u32),\\n U64(u64),\\n\\n I8(i8),\\n I16(i16),\\n I32(i32),\\n I64(i64),\\n\\n F32(f32),\\n F64(f64),\\n\\n Char(char),\\n String(String),\\n\\n Unit,\\n Option(Option<Box<Value>>),\\n ...
{ "docstring": "/// Represents a generic value that can hold various data types.\\n///\\n/// This enum can store:\\n/// - Boolean values (`Bool`)\\n/// - Unsigned integers: `u8`, `u16`, `u32`, `u64`\\n/// - Signed integers: `i8`, `i16`, `i32`, `i64`\\n/// - Floating-point numbers: `f32`, `f64`\\n/// - Characters (`Ch...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
c45290d35866968f74fe99ee2c88f7d50e6d1622da995e364d7884ab85155132
train
comment_generation
agave-cargo-registry
{ "text": "{'code': 'let (_, websocket_url) = ConfigInput::compute_websocket_url_setting(matches.value_of(\"websocket_url\").unwrap_or(\"\"), &cli_config.websocket_url, matches.value_of(\"json_rpc_url\").unwrap_or(\"\"), &cli_config.json_rpc_url);', 'code_context': 'use solana_cli_config::ConfigInput;\\nuse solana_cl...
{ "commented_code": "let (_, websocket_url) = ConfigInput::compute_websocket_url_setting(matches.value_of(\"websocket_url\").unwrap_or(\"\"), &cli_config.websocket_url, matches.value_of(\"json_rpc_url\").unwrap_or(\"\"), &cli_config.json_rpc_url); // Determine the WebSocket URL based on user input or default configur...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
8bc5aa4ba681f664bca21d4645957bcd2c4742664fe7b62b29d366ac47868bcc
train
docstring_generation
serde-value
{ "text": "{'code': 'pub fn to_value<T: ser::Serialize>(value: T) -> Result<Value, SerializerError> {\\n value.serialize(Serializer)\\n}', 'code_context': 'pub enum Value {\\n Bool(bool),\\n U8(u8),\\n U16(u16),\\n U32(u32),\\n U64(u64),\\n I8(i8),\\n I16(i16),\\n I32(i32),\\n I64(i64),\...
{ "docstring": "Serializes the given value `T` into a `Value` tree using the crate's `Serializer`. Returns the resulting `Value` or a `SerializerError` if serialization fails." }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
4c2ef0b175b8c12c44ed6f177def7ceec508a4861210dd06d7064ae1da2459fd
train
docstring_generation
serde-value
{ "text": "{'code': \"impl Value {\\n pub fn deserialize_into<'de, T: Deserialize<'de>>(self) -> Result<T, DeserializerError> {\\n T::deserialize(self)\\n }\\n}\", 'code_context': \"pub enum Value {\\n Bool(bool),\\n U8(u8),\\n U16(u16),\\n U32(u32),\\n U64(u64),\\n I8(i8),\\n I16(i1...
{ "docstring": "/// Deserializes this `Value` into a concrete type `T` that implements `Deserialize`.\\n///\\n/// This method consumes the `Value` and attempts to convert it into the target type `T`\\n/// by calling `T::deserialize` with `self` as the deserializer.\\n///\\n/// # Type Parameters\\n///\\n/// * `T` - Th...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
8eccbcac7e5c7ffc3ffbf64d6ddf49da101e91385acec61f9a56a560fa67cb06
train
code_generation
inotify
{ "text": "{'title': 'Filter events by file name', 'description': 'When processing a stream of inotify events I only care about events that refer to a specific file name. I want a utility that takes an iterator of events and returns only those whose `name` matches the target name, yielding owned events.', 'code_conte...
{ "code": "fn filter_events_by_name<'a, I>(events: I, target: &OsStr) -> impl Iterator<Item = EventOwned> + 'a\nwhere\n I: Iterator<Item = Event<&'a OsStr>> + 'a,\n{\n events.filter_map(move |e| {\n if e.name.as_deref() == Some(target) {\n Some(e.to_owned())\n } else {\n None...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
cc3358facef61335576e8499bdaf2eaf68fea0e04b652023f1d3af0babae1723
train
comment_generation
fragile
{ "text": "{'code': 'value: ManuallyDrop::new(value),', 'code_context': 'use std::mem::ManuallyDrop;\\nuse std::thread::ThreadId;\\n\\npub struct Fragile<T> {\\n value: ManuallyDrop<T>,\\n thread_id: ThreadId,\\n}'}" }
{ "commented_code": "// ManuallyDrop is necessary because we need to move out of here without running the Drop code in functions like `into_inner`.\nvalue: ManuallyDrop::new(value)," }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
5f83698a843b91df97bb53bdb28cf168e5d53a5c2fac92035a8085c3e8dccb1f
train
comment_generation
fragile
{ "text": "{'code': 'drop(unsafe { Box::from_raw(ptr) });', 'code_context': 'mod registry {\\n pub struct Entry {\\n pub ptr: *mut (),\\n pub drop: unsafe fn(*mut ()),\\n }\\n}\\n\\nfn example<T>(value: T) {\\n let entry = registry::Entry {\\n ptr: Box::into_raw(Box::new(value)).cast(),\...
{ "commented_code": "// SAFETY: This callback will only be called once, with the above pointer.\ndrop(unsafe { Box::from_raw(ptr) });" }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
722acbf1755778c43eaa9335ad622bc85680be31527d866f637afdc44d35663c
train
docstring_generation
quanta
{ "text": "{'code': 'impl Instant {\\\\n pub fn now() -> Instant {\\\\n crate::get_now()\\\\n }\\\\n}', 'code_context': 'pub struct Instant(pub(crate) u64);'}" }
{ "docstring": "/// Returns the current instant.\\n///\\n/// This function returns an `Instant` corresponding to \\" }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
97ad88fe00f39093817309f018ad2f05f2023f132bb34a791c7f8512b8aa3522
train
docstring_generation
quanta
{ "text": "{'code': 'impl Instant {\\\\n pub fn recent() -> Instant {\\\\n crate::get_recent()\\\\n }\\\\n}', 'code_context': 'pub struct Instant(pub(crate) u64);'}" }
{ "docstring": "Gets the most recent current time, scaled to reference time.\\n\\nThis method provides ultra-low-overhead access to a slightly-delayed version of the current time. Instead of querying the underlying source clock directly, a shared, global value is read directly without the need to scale to reference ...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
484a26a0a24be469fa3b7abe639aeb434d02b8d0a74c4dc0bd749e02c3ca66bc
train
docstring_generation
quanta
{ "text": "{'code': 'impl Instant {\\\\n pub fn duration_since(&self, earlier: Instant) -> Duration {\\\\n self.checked_duration_since(earlier).unwrap_or_default()\\\\n }\\\\n}', 'code_context': 'pub struct Instant(pub(crate) u64);'}" }
{ "docstring": "Returns the amount of time elapsed from another instant to this one.\\n\\nThis method returns a `Duration` representing the time that has passed from the `earlier` instant to this instant. If the `earlier` instant is actually later than this instant, the method returns `Duration::default()` (zero dura...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
acb5a366f4bad123aef45d1b5ae12e3b6fe2b9957e0d6266d79cd2d17783978f
train
code_review
libp2p-tls
{ "text": "{'code_before': 'let mut msg = vec![];\\nmsg.extend(P2P_SIGNING_PREFIX);\\nmsg.extend(certificate_keypair.public_key_der());', 'code_context': 'use libp2p_identity as identity;\\nconst P2P_SIGNING_PREFIX: [u8; 21] = *b\"libp2p-tls-handshake:\";\\n\\nfn make_libp2p_extension(\\n identity_keypair: &identi...
{ "code_after": "let pubkey_der = certificate_keypair.public_key_der();\nlet mut msg = Vec::with_capacity(P2P_SIGNING_PREFIX.len() + pubkey_der.len());\nmsg.extend_from_slice(P2P_SIGNING_PREFIX);\nmsg.extend_from_slice(pubkey_der);", "review_comment": "Pre-allocate vector capacity to avoid reallocations. Since we k...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
b54c1442ef15aa53cd0ccb12b26941bb74eb9e138232b1546af62f58f2ed5d92
train
code_review
libp2p-tls
{ "text": "{'code_before': 'if pki_algorithm.algorithm == OID_PKCS1_RSAENCRYPTION {\\n if signature_algorithm.algorithm == OID_PKCS1_SHA256WITHRSA {\\n return Ok(RSA_PKCS1_SHA256);\\n }\\n if signature_algorithm.algorithm == OID_PKCS1_SHA384WITHRSA {\\n return Ok(RSA_PKCS1_SHA384);\\n }\\n ...
{ "code_after": "match &pki_algorithm.algorithm {\n oid if oid == &OID_PKCS1_RSAENCRYPTION => match &signature_algorithm.algorithm {\n oid if oid == &OID_PKCS1_SHA256WITHRSA => return Ok(RSA_PKCS1_SHA256),\n oid if oid == &OID_PKCS1_SHA384WITHRSA => return Ok(RSA_PKCS1_SHA384),\n // ... (other...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
0d772bb8beeb87a7a8dcdd93529cafab266a6f45c75496eaa47ca958b0aca24a
train
comment_generation
debugid
{ "text": "{'code': 'fn parse_str(string: &str, options: ParseOptions) -> Option<DebugId> {', 'code_context': 'use std::str::FromStr; use debugid::DebugId; use uuid::Uuid;'}" }
{ "commented_code": "// This function parses a string into a DebugId based on the given options. It handles both hyphenated and compact formats.\nfn parse_str(string: &str, options: ParseOptions) -> Option<DebugId> {" }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
289d1204cde3be9a401c98b2bc2a13010ae0ab17186f1e725c256f7f58faa7d3
train
comment_generation
debugid
{ "text": "{'code': 'impl DebugId {', 'code_context': 'use std::error; use std::fmt; use uuid::{Bytes, Uuid}; use std::str; use std::fmt::Write;'}" }
{ "commented_code": "// Implementation of the DebugId struct, which represents a debug information file identifier.\nimpl DebugId {" }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
749de0d9400ece2659f4e56b8a00c32facf20fbddfbb9c58a9a8ff3d3c8f11ad
train
comment_generation
debugid
{ "text": "{'code': 'pub struct ParseOptions {', 'code_context': 'use std::str::FromStr; use debugid::DebugId;'}" }
{ "commented_code": "// Structure to configure the parsing options for DebugId.\npub struct ParseOptions {" }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
44adc98e578c8641d00e25d3ee6510ea105f71f6e3ce15ad2b294857425404cf
train
comment_generation
debugid
{ "text": "{'code': 'let slice = &[debug_id];', 'code_context': 'use std::mem; use std::io::Cursor; use std::io::copy;'}" }
{ "commented_code": "// Get a slice of the debug_id.\nlet slice = &[debug_id];" }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
568c740a1de785b576a9391e845cb61acc8a0b4281e4efeae0106dcbaa3e438a
train
bug_detection
ratatui-macros
{ "text": "{'buggy_code': 'constraints![,];', 'code_context': 'use ratatui_core::layout::Constraint;\\nuse ratatui_core::style::Modifier;\\nuse ratatui_macros::{constraints, span};\\n\\nfn main() {\\n constraints![];\\n\\n let [a, b] = constraints![\\n == 1/2,\\n == 2\\n ];\\n assert_eq!(a, ...
{ "fixed_code": "constraints![];", "bug_description": "An empty constraint list with a stray comma does not match any macro rule, leading to a compile error. Removing the comma yields a valid empty list." }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
77095020941d183b509704a267a97025d22fc8ef8f8619b0e0b434f51db00b24
train
code_review
float-cmp
{ "text": "{'code_before': 'let eps = f32abs(self - other);', 'code_context': 'pub fn f32abs(x: f32) -> f32 {\\n f32::from_bits(x.to_bits() & !(1 << 31))\\n}'}" }
{ "code_after": "let eps = (self - other).abs();", "review_comment": "Replaced the custom `f32abs` helper with the standard `.abs()` method. This removes unnecessary bit‑twiddling, makes the intent clear, and relies on the well‑tested standard library implementation." }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
611177f415a55e07f513ad77a10fa0755a4daf69861462166445ed8061c96488
train
code_review
float-cmp
{ "text": "{'code_before': 'saturating_abs_i32!(diff) <= margin.ulps', 'code_context': 'macro_rules! saturating_abs_i32 {\\n ($val:expr) => {\\n if $val.is_negative() {\\n match $val.checked_neg() {\\n Some(v) => v,\\n None => i32::MAX,\\n }\\n } el...
{ "code_after": "diff.abs() <= margin.ulps", "review_comment": "Used the built‑in `abs()` method on the `i32` difference instead of the `saturating_abs_i32!` macro. The standard method is clearer and avoids macro overhead while providing the same semantics." }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
c0904639d70f3368eeba1793055c23b93edc608492c43dd7767a76194e3c500c
train
variable_naming
unicode-linebreak
{ "text": "{'code': 'let __placeholder__ = PAIR_TABLE[state as usize][cls as usize];', 'code_context': 'use unicode_linebreak::PAIR_TABLE;\\n\\nfn lookup(state: u8, cls: u8) -> u8 {\\n let __placeholder__ = PAIR_TABLE[state as usize][cls as usize];\\n __placeholder__\\n}'}" }
{ "variable_name": "pair_value" }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
41bef493c6bd9ab157a6e307186fb0b5917a1d5d51c6492868eecb85c714089d
train
code_generation
dotenvy
{ "text": "{'title': 'Merge Multiple .env Files with Priority', 'description': 'A developer needs to merge environment variables from two .env files, where variables in the second file override those in the first. They want a helper that loads both files in order and returns a combined EnvMap.', 'code_context': 'use ...
{ "code": "pub fn merge_env_files(path1: &str, path2: &str) -> Result<EnvMap, Box<dyn std::error::Error>> {\n let mut loader1 = EnvLoader::with_path(path1).sequence(EnvSequence::InputThenEnv);\n let mut env_map = loader1.load()?;\n let mut loader2 = EnvLoader::with_path(path2).sequence(EnvSequence::InputOnly...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
1d5ad2e695005d48c631c4f860434de70fbc8532a049ee8824ed8d443b9fd698
train
comment_generation
agave-cargo-registry
{ "text": "{'code': 'let (_, commitment) = ConfigInput::compute_commitment_config(matches.value_of(\"commitment\").unwrap_or(\"\"), &cli_config.commitment);', 'code_context': 'use solana_cli_config::ConfigInput;\\nuse solana_cli::cli::CliConfig;\\nuse clap::ArgMatches;\\n\\nfn dummy(matches: &ArgMatches, cli_config: ...
{ "commented_code": "let (_, commitment) = ConfigInput::compute_commitment_config(matches.value_of(\"commitment\").unwrap_or(\"\"), &cli_config.commitment); // Determine the commitment level based on user input or default configuration" }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
034d69786874b8e7cdaccec070ca80c5579118b21f84a99f6f974b85d4077b7c
train
code_generation
difflib
{ "text": "{'title': 'Filter unwanted characters from a slice of strings', 'description': 'When preparing text for diffing, a developer may want to remove specific characters (e.g., spaces or tabs) from each line. This helper returns a new vector with the filtered strings.', 'code_context': None, 'function_signature'...
{ "code": "fn filter_chars(sequence: &[&str], chars_to_remove: &[char]) -> Vec<String> {\n sequence.iter()\n .map(|s| s.chars().filter(|c| !chars_to_remove.contains(c)).collect())\n .collect()\n}" }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
f81094dac3a17c34673f9021620c46ef7f8e470f20230535318c2228922130a9
train
function_naming
inotify
{ "text": "{'code': 'impl Inotify {\\n pub fn __placeholder__(&mut self, buffer: &mut [u8]) -> io::Result<Events> {\\n let num_bytes = read_into_buffer(**self.fd, buffer);\\n Ok(Events::new(Arc::downgrade(&self.fd), buffer, num_bytes as usize))\\n }\\n}', 'code_context': 'use std::io;\\nuse inotif...
{ "function_name": "read_events" }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
53ea1ff63098908fa1d4a850314729f6f0b0ffcf3fb399f9ed2094af25d1b80a
train
docstring_generation
bytecheck
{ "text": "{'code': 'pub unsafe trait CheckBytes<C: Fallible + ?Sized> {\\n unsafe fn check_bytes(\\n value: *const Self,\\n context: &mut C,\\n ) -> Result<(), C::Error>;\\n}', 'code_context': None}" }
{ "docstring": "A type that can check whether a pointer points to a valid value.\n\n`CheckBytes` can be derived with [`CheckBytes`](macro@CheckBytes) or implemented manually for custom behavior.\n\n# Safety\n\n`check_bytes` must only return `Ok` if `value` points to a valid instance of `Self`. Because `value` must al...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
d61595df83e7539cc0bbbc01d226b0f40ec3bc0976d66c18c1aaeee1563956da
train
docstring_generation
bytecheck
{ "text": "{'code': 'pub unsafe trait Verify<C: Fallible + ?Sized> {\\n fn verify(&self, context: &mut C) -> Result<(), C::Error>;\\n}', 'code_context': None}" }
{ "docstring": "A type that can check whether its invariants are upheld.\n\nWhen using [the derive](macro@CheckBytes), adding `#[bytecheck(verify)]` allows implementing `Verify` for the derived type. [`Verify::verify`] will be called after the type is checked and all fields are known to be valid.\n\n# Safety\n\n- `ve...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
2842393fdbf228e034f076f96add14d408abe753aaa96a707d14e7f2d99d34d3
train
docstring_generation
bytecheck
{ "text": "{'code': '#[inline]\\npub unsafe fn check_bytes<T, E>(value: *const T) -> Result<(), E>\\nwhere\\n T: CheckBytes<Strategy<(), E>> + ?Sized,\\n{\\n // SAFETY: The safety conditions of `check_bytes_with_context` are the same\\n // as the safety conditions of this function.\\n unsafe { check_bytes...
{ "docstring": "/// Checks whether the given pointer points to a valid value.\\n///\\n/// This is a convenience function that calls [`check_bytes_with_context`] with an empty context.\\n///\\n/// # Safety\\n///\\n/// The caller must ensure that:\\n/// - `value` is properly aligned for type `T`\\n/// - `value` points ...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
d8e02edc5cf20c01c8edae299f0981ce14608848b35ea83e570a0d90723f4e12
train
docstring_generation
bytecheck
{ "text": "{'code': 'pub unsafe fn check_bytes_with_context<T, C, E>(\\n value: *const T,\\n context: &mut C,\\n) -> Result<(), E>\\nwhere\\n T: CheckBytes<Strategy<C, E>> + ?Sized,\\n{\\n // SAFETY: The safety conditions of `check_bytes` are the same as the safety\\n // conditions of this function.\\n...
{ "docstring": "Checks whether the given pointer points to a valid value within the given context.\n\n# Safety\n\nThe passed pointer must be aligned and point to enough initialized bytes to represent the type.\n\n# Example\n\n```rust\nuse core::{error::Error, fmt};\n\nuse bytecheck::{check_bytes_with_context, CheckBy...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
630ededa0727285e7351aec2dce96760f5f4d43ff7f23b0d42c61129e686b2d0
train
function_naming
solana-transaction-context
{ "text": "{'code': 'fn __placeholder__(pubkey: &Pubkey) -> bool { *pubkey == solana_sdk_ids::system_program::id() }', 'code_context': 'use solana_pubkey::Pubkey;\\nuse solana_sdk_ids::system_program;'}" }
{ "function_name": "is_system_program" }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
b256c8a60aa13fe337805fa2b520c9ec1438dd8c4c965e60ef1de2c83def9914
train
function_naming
solana-transaction-context
{ "text": "{'code': 'fn __placeholder__() -> u64 { MAX_PERMITTED_DATA_LENGTH }', 'code_context': 'const MAX_PERMITTED_DATA_LENGTH: u64 = 10 * 1024 * 1024;'}" }
{ "function_name": "max_permitted_data_length" }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
46a055683e7fddf0c16605065ff86f0d4c88e6638256246b196866ae7f3a73bf
train
function_naming
solana-transaction-context
{ "text": "{'code': 'fn __placeholder__(&self, pubkey: &Pubkey) -> Option<IndexOfAccount> { self.account_keys.iter().position(|key| key == pubkey).map(|i| i as IndexOfAccount) }', 'code_context': 'use solana_pubkey::Pubkey;\\ntype IndexOfAccount = u16;'}" }
{ "function_name": "get_account_index" }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
7dc2d04014611ada210ba1cd1f797143d2e219365eeb925fde056fbaf3859ce1
train
docstring_generation
dotenvy
{ "text": "{'code': 'pub fn var(key: &str) -> Result<String, crate::Error> {\\n env::var(key).map_err(|e| match e {\\n VarError::NotPresent => Error::NotPresent(key.to_owned()),\\n VarError::NotUnicode(os_str) => Error::NotUnicode(os_str, key.to_owned()),\\n })\\n}', 'code_context': 'pub enum Erro...
{ "docstring": "Fetches the environment variable `key` from the current process.\\n\\nThis is a wrapper around `std::env::var` that converts `std::env::VarError` to `crate::Error`.\\nThe `crate::Error` type provides more detailed error information, including the key name\\nfor missing variables and both the invalid O...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
18c081324e009d680589e469debb67f73e5f812ef3121a6ec1f0be52ae560dc3
train
docstring_generation
dotenvy
{ "text": "{'code': \"impl<'a> EnvLoader<'a> {\\n pub fn load(self) -> Result<EnvMap, crate::Error> {\\n match self.sequence {\\n EnvSequence::EnvOnly => Ok(env::vars().collect()),\\n EnvSequence::EnvThenInput => {\\n let mut existing: EnvMap = env::vars().collect();\\n ...
{ "docstring": "/// Loads environment variables according to the configured sequence strategy.\\n///\\n/// This method loads environment variables from different sources based on the\\n/// `EnvSequence` variant:\\n/// - `EnvOnly`: Returns only system environment variables\\n/// - `EnvThenInput`: Returns system enviro...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
0c0e39848576a2a2b573f04cd081a87d11678862a4530e68207ea865bb0ce39a
train
docstring_generation
dotenvy
{ "text": "{'code': \"impl<'a> EnvLoader<'a> {\\n pub unsafe fn load_and_modify(self) -> Result<EnvMap, crate::Error> {\\n match self.sequence {\\n EnvSequence::EnvOnly => Err(Error::InvalidOp),\\n EnvSequence::EnvThenInput => {\\n let mut existing: EnvMap = env::vars()....
{ "docstring": "/// Loads and processes environment variables according to the configured sequence strategy.\\n///\\n/// This method handles different loading strategies based on the `EnvSequence` variant:\\n/// - `EnvOnly`: Returns an `InvalidOp` error\\n/// - `EnvThenInput`: Loads existing environment variables, th...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
fab84ebb37aaf41d97126001c32f653a6835a39eddec81a3efd7597c73243587
train
function_naming
simple_asn1
{ "text": "{'code': 'fn __placeholder__(blocks: &[ASN1Block]) -> Option<&ASN1Block> {\\n blocks.iter().find(|block| matches!(block, ASN1Block::Sequence(_, _)))\\n}', 'code_context': 'enum ASN1Block { Sequence(usize, Vec<ASN1Block>) }'}" }
{ "function_name": "find_sequence_block" }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
bc21a7320d91f7d0e7ebb15f067b1f2ad9889b7ad84dd221d7edad2789c53e63
train
function_naming
simple_asn1
{ "text": "{'code': 'fn __placeholder__(block: &ASN1Block) -> bool {\\n matches!(block, ASN1Block::Explicit(_, _, _, _))\\n}', 'code_context': 'enum ASN1Class { Universal, Application, ContextSpecific, Private }\\nuse num_bigint::BigUint;\\nenum ASN1Block { Explicit(ASN1Class, usize, BigUint, Box<ASN1Block>) }'}" ...
{ "function_name": "is_explicitly_tagged" }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
2caddde4e4f4a56160cbfe9a0ef4eaabbdcd6cb676e8e889a82d44a90e5d061e
train
comment_generation
agave-cargo-registry
{ "text": "{'code': 'let server_url = value_t!(matches, \"server_url\", String).unwrap_or(format!(\"http://0.0.0.0:{}\", port));', 'code_context': 'use clap::{value_t, ArgMatches};\\n\\nfn dummy(matches: &ArgMatches, port: u16) {\\n // the body is intentionally empty; the line above uses `matches` and `port`\\n}'}...
{ "commented_code": "let server_url = value_t!(matches, \"server_url\", String).unwrap_or(format!(\"http://0.0.0.0:{}\", port)); // Set the server URL based on user input or default to binding to all interfaces on the specified port" }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
9d05c1dee2cd26cdf708de257c6731f5ce24ea1de2bde29742c36f113c1379ea
train
function_naming
simple_asn1
{ "text": "{'code': 'fn __placeholder__(block: &ASN1Block) -> Option<&BigUint> {\\n if let ASN1Block::ObjectIdentifier(_, oid) = block {\\n oid.0.get(0)\\n } else {\\n None\\n }\\n}', 'code_context': 'use num_bigint::BigUint;\\nstruct OID(Vec<BigUint>);\\nenum ASN1Block { ObjectIdentifier(usize...
{ "function_name": "get_first_oid_component" }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
315a00cf01adbfd78458d5561c430fe606b39835a471039bc9fb035e38858707
train
function_naming
simple_asn1
{ "text": "{'code': 'fn __placeholder__(blocks: &[ASN1Block]) -> Result<Vec<ASN1Block>, ASN1DecodeErr> {\\n Ok(blocks.iter()\\n .filter(|block| matches!(block, ASN1Block::Sequence(_, _)))\\n .cloned()\\n .collect())\\n}', 'code_context': 'enum ASN1DecodeErr {}\\nenum ASN1Block { Sequence(usize...
{ "function_name": "filter_sequence_blocks" }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
88c38c26d6f68db85968a73bb70c134f4597f0e61b16fd02e84e5e34924ef3e4
train
function_naming
simple_asn1
{ "text": "{'code': 'fn __placeholder__(block: &ASN1Block) -> Result<Vec<u8>, ASN1EncodeErr> {\\n to_der(block)\\n}', 'code_context': 'enum ASN1EncodeErr {}\\nfn to_der(_i: &ASN1Block) -> Result<Vec<u8>, ASN1EncodeErr> { Ok(vec![]) }\\nenum ASN1Block {}'}" }
{ "function_name": "encode_block_der" }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
cb8e605d103e4d122fd8262e57a5498f9447b97609086b506d4e7c03757d42b7
train
code_generation
parquet-variant-json
{ "text": "{'title': 'Parse JSON array of objects into Variant list and serialize back to JSON', 'description': 'A developer receives a JSON array where each element is an object representing a record. They need a helper that parses the array into a Variant (list) and then returns a compact JSON string of the same st...
{ "code": "pub fn parse_and_roundtrip(json: &str) -> Result<String, ArrowError> {\n let mut builder = VariantBuilder::new();\n json_to_variant(json, &mut builder)?;\n let (metadata, value) = builder.finish();\n let variant = Variant::try_new(&metadata, &value)?;\n variant_to_json_string(&variant)\n}" }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
efc13e7331e2b26f8e4387d873f3af31abc5b09b2a6cdaf3bf31b828d3cae08b
train
code_generation
parquet-variant-json
{ "text": "{'title': 'Extract optional string field from Variant object with default', 'description': 'A developer has a Variant representing a JSON object that may or may not contain a \"name\" field. They need a utility that safely extracts the field as a Rust String, returning a default value when the field is mis...
{ "code": "pub fn get_name_field(variant: &Variant) -> Result<String, ArrowError> {\n match variant {\n Variant::Object(obj) => {\n let mut found: Option<&Variant> = None;\n for (key, value) in obj.iter() {\n if key == \"name\" {\n found = Some(value);...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
415df12b8dbc252f4a5b982b0bd5881b18bfaf0e0b08db6838eab5a4970ffde7
train
code_generation
parquet-variant-json
{ "text": "{'title': 'Serialize binary payload as base64 within a JSON object', 'description': 'A developer needs to embed raw binary data into JSON for transport. The helper builds a Variant object with a single \"payload\" field containing the binary data, which is automatically base64‑encoded by the crate\\'s JSON...
{ "code": "pub fn binary_to_json(payload: &[u8]) -> Result<String, ArrowError> {\n let mut builder = VariantBuilder::new();\n let mut obj = builder.new_object();\n obj.insert(\"payload\", Variant::Binary(payload));\n obj.finish()?;\n let (metadata, value) = builder.finish();\n let variant = Variant:...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
a594f770ecaad3124b46ad67349386a402fb7883fdd16b5e0962d7dc70963ea2
train
code_generation
parquet-variant-json
{ "text": "{'title': 'Batch convert multiple JSON strings into a Variant list', 'description': 'A developer processes a slice of JSON strings, each representing an independent record. They need a function that parses each string into its own Variant and collects the results into a single Variant list for downstream p...
{ "code": "pub fn batch_json_to_variant_list(jsons: &[&str]) -> Result<Variant<'static, 'static>, ArrowError> {\n let mut builder = VariantBuilder::new();\n let mut list = builder.new_list();\n for json in jsons {\n let mut inner_builder = VariantBuilder::new();\n json_to_variant(json, &mut inn...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
3702e4428f93f99bb3c223547c7a1d5f1d25762c4a37d7c4e8f462c2ece4c711
train
docstring_generation
lz4-sys
{ "text": "{'code': 'impl<R: Read> Decoder<R> {\\n pub fn new(r: R) -> Result<Decoder<R>> {\\n Ok(Decoder {\\n r,\\n c: DecoderContext::new()?,\\n buf: vec![0; BUFFER_SIZE].into_boxed_slice(),\\n pos: BUFFER_SIZE,\\n len: BUFFER_SIZE,\\n // M...
{ "docstring": "/// Creates a new LZ4 decoder that reads compressed data from the given input stream.\\n///\\n/// # Arguments\\n///\\n/// * `r` - The input stream to read compressed LZ4 data from\\n///\\n/// # Returns\\n///\\n/// Returns `Ok(Decoder<R>)` on success, or an error if the decoder context\\n/// initializa...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
1cc9c5339122690538f80b13c33fbca00325b985d8a94a39f8aa130f9497c7f4
train
docstring_generation
lz4-sys
{ "text": "{'code': 'pub fn compress(src: &[u8], mode: Option<CompressionMode>, prepend_size: bool) -> Result<Vec<u8>> {\\n // 0 iff src too large\\n let compress_bound: i32 = unsafe { LZ4_compressBound(src.len() as i32) };\\n\\n if src.len() > (i32::max_value() as usize) || compress_bound <= 0 {\\n r...
{ "docstring": "/// Compresses the input data using LZ4 compression.\\n///\\n/// # Arguments\\n///\\n/// * `src` - The source data to compress\\n/// * `mode` - Optional compression mode. If `None`, uses default compression\\n/// * `prepend_size` - If `true`, prepends the original size to the compressed output\\n///\\...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
3a6a647c71ede7a46d4b538bbeb664c0c282ac1cfdd9845d06f295e49e002707
train
docstring_generation
lz4-sys
{ "text": "{'code': 'pub fn decompress(src: &[u8], uncompressed_size: Option<i32>) -> Result<Vec<u8>> {\\n let size = get_decompressed_size(src, uncompressed_size)?;\\n\\n let mut buffer = vec![0u8; size];\\n\\n let sz = decompress_to_buffer(src, uncompressed_size, &mut buffer)?;\\n buffer.truncate(sz);\\...
{ "docstring": "/// Decompresses LZ4-compressed data from the source buffer.\\n///\\n/// # Arguments\\n///\\n/// * `src` - A byte slice containing the compressed data\\n/// * `uncompressed_size` - Optional size of the uncompressed data. If `None`, the size\\n/// will be read from the first 4 bytes of the source buf...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
687838f8544f9ff6a4032a93ade6ae20e0725a42ec397e0d476d093e5a0cca7d
train
code_generation
atoi
{ "text": "{'title': 'Parse signed integer with overflow checking', 'description': \"A developer needs to parse a signed integer from a byte slice while safely handling overflow. They want a helper that returns None when the input would overflow or is malformed, using the crate's FromRadix10SignedChecked trait.\", 'c...
{ "code": "pub fn parse_i32_signed(text: &[u8]) -> Option<i32> {\n let (opt, _) = i32::from_radix_10_signed_checked(text);\n opt\n}" }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
8358ae597b57aa6d29368361109aa7ccb51e236191e9a36be7675ea5876d9a60
train
code_generation
atoi
{ "text": "{'title': 'Parse hexadecimal number with optional 0x prefix and overflow checking', 'description': 'A developer receives hexadecimal values that may optionally start with a \"0x\" or \"0X\" prefix. They need a function that strips the prefix if present, parses the remaining digits as a u32, checks for over...
{ "code": "pub fn parse_hex_u32(text: &[u8]) -> (Option<u32>, usize) {\n let (slice, prefix_len) = if text.starts_with(b\"0x\") || text.starts_with(b\"0X\") {\n (&text[2..], 2)\n } else {\n (text, 0)\n };\n let (opt, used) = u32::from_radix_16_checked(slice);\n (opt, used + prefix_len)\n}...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
ba47cc332eeaae05972d62e1a84b7ea7441d63f9cbf2d712a9a8130b80e765bc
train
code_generation
atoi
{ "text": "{'title': 'Parse signed integer and return remaining slice', 'description': 'When processing a stream of bytes, a developer wants to parse a signed integer with overflow checking and then continue processing the rest of the data. The function should return the parsed value (or None) together with the uncon...
{ "code": "pub fn parse_signed_and_rest<I>(text: &[u8]) -> (Option<I>, &[u8])\nwhere\n I: FromRadix10SignedChecked,\n{\n let (opt, used) = I::from_radix_10_signed_checked(text);\n (opt, &text[used..])\n}" }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
77f34e7e72632b0eebd026c62576f4a121675f0edc94ef8b0ea99b08035323e0
train
code_generation
atoi
{ "text": "{'title': 'Parse large i128 number with overflow detection', 'description': \"A developer needs to parse a potentially very large decimal number into an i128, ensuring that any overflow is detected and reported as None. The function should use the crate's checked parsing trait for i128.\", 'code_context': ...
{ "code": "pub fn parse_i128(text: &[u8]) -> Option<i128> {\n let (opt, _) = i128::from_radix_10_checked(text);\n opt\n}" }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
f9ab765e2c0299bdbe61941e59574f6cfb111f5f5353338d02ac2d6af384f8ce
train
code_generation
atoi
{ "text": "{'title': 'Parse comma‑separated list of u32 values with overflow safety', 'description': 'A developer receives a byte slice containing decimal numbers separated by commas (e.g., b\"12,34,56\"). They need a helper that parses each number using overflow‑checked parsing, stops on the first error, and returns...
{ "code": "pub fn parse_u32_list(text: &[u8]) -> Option<Vec<u32>> {\n let mut remaining = text;\n let mut result = Vec::new();\n loop {\n let (opt, used) = u32::from_radix_10_checked(remaining);\n if used == 0 {\n break;\n }\n match opt {\n Some(num) => resul...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
bfa59826976877b062e88e60b1a7d6cd719eaf4f891485b42299accbe32b6c53
train
code_generation
dpi
{ "text": "{'title': 'Convert a logical position to a physical position respecting the scale factor', 'description': 'A UI developer needs to render an element at a logical coordinate. The function should validate the scale factor and convert the logical position into a physical position so the element appears at the...
{ "code": "pub fn logical_to_physical_position<P: Pixel>(logical: LogicalPosition<P>, scale_factor: f64) -> PhysicalPosition<P> {\n validate_scale_factor(scale_factor);\n logical.to_physical(scale_factor)\n}" }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
c8381ac24d6f711b9f26502c8b840ba9f96a1ae730df9047cb8c7cf3b72da3cb
train
code_generation
dpi
{ "text": "{'title': 'Clamp a logical size to minimum and maximum physical dimensions', 'description': 'When scaling UI elements, the resulting physical size must stay within predefined bounds. This helper converts a logical size to physical pixels, clamps it, and returns the clamped physical size.', 'code_context': ...
{ "code": "pub fn clamp_logical_size<P: Pixel>(\n logical: LogicalSize<P>,\n scale_factor: f64,\n min: PhysicalSize<u32>,\n max: PhysicalSize<u32>,\n) -> PhysicalSize<u32> {\n validate_scale_factor(scale_factor);\n let physical = logical.to_physical::<u32>(scale_factor);\n Size::clamp(physical, m...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
0a0f836d7b33aa9bec60d00d6503a6e7b18eb2d06b6c7bac192ebe60c10ce9e9
train
code_generation
dpi
{ "text": "{'title': 'Round a logical unit to the nearest integer pixel value', 'description': 'Rasterization often requires an integer pixel count. This function takes a logical unit, rounds its value to the nearest integer, and returns a logical unit containing an unsigned integer pixel.', 'code_context': 'use dpi:...
{ "code": "pub fn round_logical_unit<P: Pixel>(unit: LogicalUnit<P>) -> LogicalUnit<u32> {\n let value = unit.0.into();\n let rounded = value.round() as u32;\n LogicalUnit::new(rounded)\n}" }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
b651f4004041f294011c79d5d455587cb907dcfb5efed842a51c40fa82cf4092
train
code_generation
dpi
{ "text": "{'title': 'Convert a physical size to a logical size with proper rounding', 'description': 'For layout calculations a developer needs the logical size that corresponds to a given physical size and scale factor. The conversion should preserve fractional values as f64 for further processing.', 'code_context'...
{ "code": "pub fn physical_to_logical_size<P: Pixel>(\n physical: PhysicalSize<P>,\n scale_factor: f64,\n) -> LogicalSize<f64> {\n validate_scale_factor(scale_factor);\n physical.to_logical(scale_factor)\n}" }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
bc37e8fc1f7e65ddf1461e91a30718d441f59c02f75b7b8bb3062714d7859dc4
train
docstring_generation
sha1_smol
{ "text": "{'code': 'impl Sha1 {\\n pub fn new() -> Sha1 {\\n Sha1 {\\n state: DEFAULT_STATE,\\n len: 0,\\n blocks: Blocks {\\n len: 0,\\n block: [0; 64],\\n },\\n }\\n }\\n}', 'code_context': 'pub struct Sha1 {\\n state:...
{ "docstring": "/// Creates a new SHA-1 hasher.\\n///\\n/// This initializes a fresh SHA-1 hasher with the default state, ready to process input data.\\n///\\n/// # Examples\\n///\\n/// ```\\n/// let hasher = Sha1::new();\\n/// ```" }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
56d4cb6e73fad8610d5cdb62a1e2ad68e3002184697cee3e06de9ed3f5329414
train
docstring_generation
sha1_smol
{ "text": "{'code': 'impl Sha1 {\\n pub fn from<D: AsRef<[u8]>>(data: D) -> Sha1 {\\n let mut rv = Sha1::new();\\n rv.update(data.as_ref());\\n rv\\n }\\n}', 'code_context': 'pub struct Sha1 {\\n state: Sha1State,\\n blocks: Blocks,\\n len: u64,\\n}\\n\\nstruct Blocks {\\n len: ...
{ "docstring": "Shortcut to create a sha1 from some bytes.\n\nThis also lets you create a hash from a utf-8 string. This is equivalent\n to making a new Sha1 object and calling `update` on it once." }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
28f84786547830c952bf878e8a3290c36ea00c4fbb34edd74ddcdce2309d89a0
train
docstring_generation
sha1_smol
{ "text": "{'code': 'impl Digest {\\n pub fn bytes(&self) -> [u8; DIGEST_LENGTH] {\\n [\\n (self.data.state[0] >> 24) as u8,\\n (self.data.state[0] >> 16) as u8,\\n (self.data.state[0] >> 8) as u8,\\n (self.data.state[0] >> 0) as u8,\\n (self.data.state...
{ "docstring": "Returns the 160 bit (20 byte) digest as a byte array." }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
a502dc3986ddb513b17012c361a949dd5f317e89687baa4e66d3b6a1dc02e46e
train
docstring_generation
sha1_smol
{ "text": "{'code': 'impl Sha1 {\\n #[cfg(feature = \"alloc\")]\\n pub fn hexdigest(&self) -> std::string::String {\\n use std::string::ToString;\\n self.digest().to_string()\\n }\\n}', 'code_context': 'pub struct Sha1 {\\n state: Sha1State,\\n blocks: Blocks,\\n len: u64,\\n}\\n\\nstr...
{ "docstring": "/// Returns the SHA-1 digest as a hexadecimal string.\\n///\\n/// This method computes the final SHA-1 hash and returns it as a lowercase\\n/// hexadecimal string representation.\\n///\\n/// # Returns\\n///\\n/// A `String` containing the hexadecimal representation of the SHA-1 digest.\\n///\\n/// # N...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
a7408e5419c2d7c1ef83d0e1bd8ae052d617320d1bd9e3b5cd6bcab5c44944a0
train
docstring_generation
sha1_smol
{ "text": "{'code': 'impl Sha1 {\\n pub fn update(&mut self, data: &[u8]) {\\n let len = &mut self.len;\\n let state = &mut self.state;\\n self.blocks.input(data, |block| {\\n *len += block.len() as u64;\\n state.process(block);\\n })\\n }\\n}', 'code_context': ...
{ "docstring": "/// Updates the SHA-1 hash state with the provided input data.\\n///\\n/// This method processes the input data in blocks, updating the internal\\n/// hash state and tracking the total length of data processed.\\n///\\n/// # Parameters\\n///\\n/// * `data` - A byte slice containing the data to be hash...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
48343d846021ff2ba9da4b8c7cad129098064e1cf1197e6105e683396ff175ac
train
code_summarization
dotenvy
{ "text": "{'code': 'pub fn parse_line(\\n line: &str,\\n substitution_data: &mut HashMap<String, Option<String>>,\\n) -> Result<Option<(String, String)>, ParseBufError> {\\n let mut parser = LineParser::new(line, substitution_data);\\n parser.parse_line()\\n}', 'code_context': \"use std::collections::Has...
{ "summary": "Creates a LineParser instance and delegates line parsing to it, returning the result which could be a key-value pair, None, or a parse error." }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
6dbb44cde1f840d77a93ef8a14951b54d9646cf0972542f99578ac2f8435c3ac
train
code_summarization
dotenvy
{ "text": "{'code': '#[proc_macro]\\npub fn dotenv(input: TokenStream) -> TokenStream {\\n let input = input.into();\\n unsafe { dotenv_inner(input) }.into()\\n}', 'code_context': 'use dotenvy::EnvLoader;\\nuse proc_macro::TokenStream;\\nuse proc_macro2::TokenStream as TokenStream2;\\nuse quote::quote;\\nuse st...
{ "summary": "Procedural macro that loads environment variables from a .env file at compile time and expands to the value of a specified environment variable, emitting a compile error if the variable is missing or invalid." }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
84e840d166f49386f7480489f465cce66c0b119f3fe3ce365d1694aba3e992a6
train
docstring_generation
libp2p-webtransport-websys
{ "text": "{'code': '#[derive(Debug)]\\npub struct Connection {\\n inner: SendWrapper<ConnectionInner>,\\n}', 'code_context': 'use crate::bindings::{WebTransport, WebTransportBidirectionalStream};\\nuse crate::fused_js_promise::FusedJsPromise;\\nuse web_sys::ReadableStreamDefaultReader;\\n\\npub struct ConnectionI...
{ "docstring": "/// An opened WebTransport connection.\\n///\\n/// This struct wraps a `ConnectionInner` that contains the actual WebTransport session\\n/// and related state for managing bidirectional streams. The connection is wrapped\\n/// in a `SendWrapper` to enable sending across thread boundaries in single-thr...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
489b7d2879642bb22a22a49274dba37029c32858aa66689b11bfbe49193e90a9
train
code_refactoring
derive-new
{ "text": "{'code_before': 'fn path_to_string(path: &syn::Path) -> String {\\n path.segments\\n .iter()\\n .map(|s| s.ident.to_string())\\n .collect::<Vec<String>>()\\n .join(\"::\")\\n}', 'code_context': 'use syn::Path;\\n\\nfn path_to_string(path: &Path) -> String {\\n path.segment...
{ "rationale": "Collects identifiers into a `Vec<_>` instead of `Vec<String>`, avoiding an unnecessary generic type parameter and reducing allocation overhead while keeping the same behaviour.", "code_after": "fn path_to_string(path: &syn::Path) -> String {\n path.segments\n .iter()\n .map(|s| s.id...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
d300e8f9cfe5fbfaaaded721e832d23867c4795bef2fceee31facc26fc046c04
train
code_refactoring
solana-frozen-abi
{ "text": "{'code_before': 'impl<T: AbiExample> AbiExample for Vec<T> {\\n fn example() -> Self {\\n vec![T::example()]\\n }\\n}', 'code_context': 'pub trait AbiExample: Sized {\\n fn example() -> Self;\\n}\\n\\nimpl<T: AbiExample> AbiExample for Vec<T> {\\n fn example() -> Self {\\n std::it...
{ "rationale": "Uses an iterator with `once` and `collect` instead of constructing a vector literal, showcasing a more functional style and aligning with Rust’s iterator conventions.", "code_after": "impl<T: AbiExample> AbiExample for Vec<T> {\n fn example() -> Self {\n std::iter::once(T::example()).colle...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
ab5adb3948d91fe144c347279b65715ae4746f5bfe50f5436e4c81db90b2390b
train
docstring_generation
libp2p-webtransport-websys
{ "text": "{'code': 'pub(crate) fn parse_reader_response(resp: &JsValue) -> Result<Option<JsValue>, JsValue> {\\n let value = Reflect::get(resp, &JsValue::from_str(\"value\"))?;\\n let done = Reflect::get(resp, &JsValue::from_str(\"done\"))?\\n .as_bool()\\n .unwrap_or_default();\\n\\n if value...
{ "docstring": "Parse response from `ReadableStreamDefaultReader::read`.\n\nThis function extracts the `value` and `done` fields from the JavaScript object returned by a stream read operation. It returns `Ok(None)` if the stream is finished or the value is undefined, otherwise returns `Ok(Some(value))`." }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
08a3baf7fc7950a8a8c9d4105c3d4403f7f4cb35859d3d18020dbba381d01fdc
train
docstring_generation
libp2p-webtransport-websys
{ "text": "{'code': '#[derive(Debug)]\\npub(crate) struct FusedJsPromise {\\n promise: Option<JsFuture>,\\n}', 'code_context': 'use std::future::Future;\\nuse std::pin::Pin;\\nuse std::task::{Context, Poll};\\nuse js_sys::Promise;\\nuse wasm_bindgen_futures::JsFuture;'}" }
{ "docstring": "/// A wrapper around a JavaScript promise that can be polled to completion.\\n///\\n/// This struct provides a convenient way to handle JavaScript promises in Rust\\n/// by wrapping an optional `JsFuture`. The `Option` allows the promise to be\\n/// taken/consumed during polling operations." }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
a7b3ed90af0196f0dd15375c301ba15fa9b9f373e9cd79161384c9c7eb183386
train
code_summarization
libp2p-webtransport-websys
{ "text": "{'code': 'impl StreamInner {\\n fn poll_reader_read(&mut self, cx: &mut Context) -> Poll<io::Result<Option<Uint8Array>>> {\\n let val = ready!(self\\n .reader_read_promise\\n .maybe_init(|| self.reader.read())\\n .poll_unpin(cx))\\n .map_err(to_io_error);\\...
{ "summary": "Polls a JavaScript promise for reading data from a ReadableStream, converts the result to a Uint8Array, and handles errors by converting them to IO errors." }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
a9277b8acb33407d3ba9a29ffdf4f4d014237d9786dda813a331ca9684182c2d
train
code_summarization
libp2p-webtransport-websys
{ "text": "{'code': 'impl ConnectionInner {\\n fn poll_create_bidirectional_stream(&mut self, cx: &mut Context) -> Poll<Result<Stream, Error>> {\\n let val = ready!(self\\n .create_stream_promise\\n .maybe_init(|| self.session.create_bidirectional_stream())\\n .poll_unpin(cx...
{ "summary": "Polls the promise to create a bidirectional stream, converting the result into a `Stream` object." }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
b699623accd648c472f64ccff5e2ee54da337e6004e9eeb7a5f6f65a751bc1a7
train
code_summarization
libp2p-webtransport-websys
{ "text": "{'code': 'impl Endpoint {\\n fn url(&self) -> String {\\n let host = &self.host;\\n let port = self.port;\\n if self.is_ipv6 {\\n format!(\"https://[{host}]:{port}/.well-known/libp2p-webtransport?type=noise\")\\n } else {\\n format!(\"https://{host}:{por...
{ "summary": "Constructs a libp2p WebTransport URL with noise protocol support, formatting IPv6 addresses with brackets and using the standard well-known path." }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
fc470de97ef929c16d9f823c5b73c633dcfd8f69aedaa6865f0c6c685f25bd5d
train
comment_generation
objc2-intents
{ "text": "{'code': 'pub fn new() -> Self {\\n Self {\\n inner: Inner::new(),\\n }\\n}', 'code_context': 'pub struct Inner;\\n\\nimpl Inner {\\n pub fn new() -> Self {\\n Self\\n }\\n}\\n\\npub struct MyStruct {\\n inner: Inner,\\n}'}" }
{ "commented_code": "pub fn new() -> Self {\n // Initialize a new instance with a default inner state\n Self {\n inner: Inner::new(),\n }\n}" }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
2eb6bda54f820b35f2f8a0d75c86b1680580ec0d860e287574ac4235bb34588c
train
docstring_generation
libp2p-websocket
{ "text": "{'code': '#[derive(Debug)]\\npub enum Error<E> {\\n Transport(E),\\n Tls(tls::Error),\\n Handshake(Box<dyn error::Error + Send + Sync>),\\n TooManyRedirects,\\n InvalidMultiaddr(Multiaddr),\\n InvalidRedirectLocation,\\n Base(Box<dyn error::Error + Send + Sync>),\\n}', 'code_context': ...
{ "docstring": "/// Error types that can occur in WebSocket operations.\\n///\\n/// This enum represents various error conditions that may arise during WebSocket\\n/// communication, including transport errors, TLS errors, handshake failures,\\n/// and protocol-specific issues.\\n///\\n/// # Variants\\n///\\n/// * `T...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
50b88842dfc6261075e65e44c94ca7a6bfe764efb580d51ed08187891444ff96
train
docstring_generation
libp2p-websocket
{ "text": "{'code': \"#[derive(Debug)]\\npub struct Config<T> {\\n transport: Arc<Mutex<T>>,\\n max_data_size: usize,\\n tls_config: tls::Config,\\n max_redirects: u8,\\n listener_protos: HashMap<ListenerId, WsListenProto<'static>>,\\n}\", 'code_context': \"#[derive(Debug, PartialEq, Eq, Hash, Clone)]\...
{ "docstring": "Configuration structure for WebSocket transport.\\n\\nThis struct holds the configuration parameters needed to set up and manage\\nWebSocket connections, including transport layer settings, security options,\\nand protocol specifications.\\n\\n# Fields\\n\\n* `transport` - Thread-safe transport layer ...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
f811c515cae18f33308b211c33e99405c3b7cbad59498d430c62c09b8f7d3b33
train
docstring_generation
libp2p-websocket
{ "text": "{'code': 'impl<T> Config<T>\\nwhere\\n T: Send,\\n{\\n pub fn new(transport: T) -> Self {\\n Config {\\n transport: Arc::new(Mutex::new(transport)),\\n max_data_size: MAX_DATA_SIZE,\\n tls_config: tls::Config::client(),\\n max_redirects: 0,\\n ...
{ "docstring": "/// Creates a new `Config` instance with the provided transport.\\n///\\n/// # Arguments\\n///\\n/// * `transport` - The underlying transport implementation that must implement `Send`\\n///\\n/// # Returns\\n///\\n/// A new `Config` instance with:\\n/// - The transport wrapped in `Arc<Mutex<T>>`\\n///...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
adf2d718b059672a8635784b990278182f448f37aab9c195ef079de8f7f3441f
train
code_optimization
libp2p-webtransport-websys
{ "text": "{'code_before': 'let mut result = String::new();\\nresult.push_str(prefix);\\nresult.push_str(suffix);\\nresult', 'code_context': 'use std::string::String;'}" }
{ "rationale": "Allocates the exact amount of memory needed for the final string up front, avoiding multiple reallocations as the string grows, which reduces heap allocations and copying.", "code_after": "let mut result = String::with_capacity(prefix.len() + suffix.len());\nresult.push_str(prefix);\nresult.push_str...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
e6069a2571e5f95862f6cebb7c51bf0be90980f160435bc9fb12dbe80786e59b
train
code_optimization
libp2p-webtransport-websys
{ "text": "{'code_before': 'let mut sum = 0u64;\\nfor &x in data.iter() {\\n sum += x;\\n}\\nsum', 'code_context': 'use std::iter::Iterator;'}" }
{ "rationale": "Leverages the highly optimized `Iterator::sum` implementation, removing the explicit loop and mutable accumulator, which can be faster due to internal optimizations and reduces code complexity.", "code_after": "let sum: u64 = data.iter().sum();" }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
afae792a20943aa1b46e7da5695df17546ed34f30afadf1beb48c90b3410797d
train
code_generation
libp2p-webtransport-websys
{ "text": "{'title': 'Convert Multiaddr to WebTransport URL', 'description': 'A developer needs to convert a `Multiaddr` into the WebTransport URL used by the libp2p‑webtransport‑websys crate. The helper should parse the multiaddr, build an `Endpoint` and return the URL string, propagating any crate errors.', 'code_c...
{ "code": "pub fn multiaddr_to_webtransport_url(addr: &multiaddr::Multiaddr) -> Result<String, libp2p_webtransport_websys::Error> {\n let endpoint = libp2p_webtransport_websys::endpoint::Endpoint::from_multiaddr(addr)?;\n Ok(endpoint.url())\n}" }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
af443c7d2219d53337dbc62ee45de69f542294b6127a813463a5603a71aab588
train
code_generation
libp2p-webtransport-websys
{ "text": "{'title': 'Wrap WebTransportBidirectionalStream into libp2p Stream', 'description': 'When a low‑level `WebTransportBidirectionalStream` is obtained from the browser API, the developer wants to turn it into the higher‑level `libp2p_webtransport_websys::Stream` type used by the rest of the library.', 'code_c...
{ "code": "pub fn webtransport_to_libp2p_stream(bidi: libp2p_webtransport_websys::bindings::WebTransportBidirectionalStream) -> Result<libp2p_webtransport_websys::Stream, libp2p_webtransport_websys::Error> {\n let stream = libp2p_webtransport_websys::Stream::new(bidi)?;\n Ok(stream)\n}" }
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
ccc387a350a5872f1b67fcc70aaaebfa42cd78a668be0a55482c049c70904e44
train
code_generation
libp2p-webtransport-websys
{ "text": "{'title': 'Add a server certificate hash to WebTransportOptions', 'description': 'The crate provides `WebTransportOptions` but only a setter for the whole hash list. A helper that creates a `WebTransportHash` from a SHA‑256 digest and appends it to the options makes configuring custom certificates easier.'...
{ "code": "pub fn add_server_cert_hash(opts: &mut libp2p_webtransport_websys::bindings::WebTransportOptions, hash_bytes: &[u8]) -> Result<(), libp2p_webtransport_websys::Error> {\n use js_sys::{Array, Uint8Array};\n use libp2p_webtransport_websys::bindings::WebTransportHash;\n\n let digest = Uint8Array::from...
Fortytwo-Network/Strandset-Rust-v1
Apache-2.0
1d0a7498c7fd086d102c1f86689860a5dbdd0f7cc2f0619e17649eae9ef63f56
train
End of preview.

Rust AI Multi-Source Dataset

A multi-source Rust programming dataset.

Files

  • sft_train.jsonl: SFT training examples
  • sft_validation.jsonl: SFT validation examples
  • sft_all.jsonl: All SFT examples
  • pretrain_rust_code.jsonl: Raw Rust code corpus
  • collection_report.json: Collection statistics

Statistics

  • SFT total: 201377
  • SFT train: 191308
  • SFT validation: 10069
  • Raw Rust code: 93381

Sources

  • DavidBPunkt/Strandset-Rust-v1
  • Convence/Rust-Coder
  • NickIBrody/rust-code-suite
  • rust-lang/book

Filtering

Exact duplicate content is removed.

Raw code corpus entries are retained only when their record-level license matches the allowlist:

MIT, Apache-2.0, BSD-2-Clause, BSD-3-Clause, ISC, 0BSD.

Unknown or non-allowlisted licenses are excluded from the raw code corpus.

Important limitations

Source dataset quality claims are not independently verified by this collection script.

The SFT examples are not all compiler-tested here. The raw code corpus is intended for code pretraining, not instruction tuning.

The dataset uses mixed upstream licenses. Review each source and its attribution requirements before redistribution or commercial use.

Downloads last month
60