Results for “Collections & data structures”
Small, practical examples. Search by task or narrow things down below.
Represent a record with a dataclass
Python: Generate initialization and convert a typed record to a dictionary.
Python✓ Tested
Return typed data from an async function
Await a Promise and handle failures explicitly.
async✓ Tested
Separate table headings data and totals
HTML: Thead, tbody, and tfoot group rows according to their purpose.
HTML✓ Tested
Share data through a named volume
Keep a file across two short-lived containers.
volume✓ Tested
Share immutable data with Arc
Share immutable data with Arc in a complete Rust program using the standard library.
Rust✓ Tested
Store data in an enum variant
Store data in an enum variant in a complete Rust program using the standard library.
Rust✓ Tested
Accept different types with a generic function
Accept different types with a generic function in a complete Rust program using the standard library.
Rust✓ Tested
Apply classes from explicit Boolean state
jQuery: The second toggleClass argument applies a known state consistently.
jQuery✓ Tested
Assign a network-scoped alias
Docker / Compose: An alias gives an endpoint an additional name on that network.
Docker / Compose✓ Tested
Attach an existing container to another network
Docker / Compose: network connect adds an attachment without recreating the container.
Docker / Compose✓ Tested
Attach configuration when registering a handler
jQuery: event.data carries the registration-time data object.
jQuery✓ Tested
Build an object from key-value entries
JavaScript: Object.fromEntries converts an iterable of pairs into ordinary own properties.
JavaScript✓ Tested