Results for “Structures & function interfaces”
Small, practical examples. Search by task or narrow things down below.
Capture a surrounding value in a closure
Capture a surrounding value in a closure in a complete Rust program using the standard library.
Rust✓ Tested
Capture output while handling a failed command
Bash Scripts: An assignment inherits the status of its command substitution, allowing both output and status to be handled.
Bash Scripts✓ Tested
Capture state in a closure
Capture state in a closure using a complete Go program with explicit sample inputs.
Go✓ Tested
Choose the smaller of a fixed and viewport-relative size
CSS: Min selects whichever supplied length is smaller at the current viewport.
CSS✓ Tested
Collect independent asynchronous results
Python: Use asyncio.gather to await multiple coroutines while preserving input order.
Python✓ Tested
Combine collections as a distinct set
C#: Union retains each value once across both inputs.
C#✓ Tested
Construct a struct with default values
Construct a struct with default values in a complete Rust program using the standard library.
Rust✓ Tested
Define behavior with a trait
Define behavior with a trait in a complete Rust program using the standard library.
Rust✓ Tested
Define related integer constants
Define related integer constants using a complete Go program with explicit sample inputs.
Go✓ Tested
Derive comparison and debugging behavior
Derive comparison and debugging behavior in a complete Rust program using the standard library.
Rust✓ Tested
Dispatch values with wildcard patterns
PowerShell: Switch -Wildcard interprets shell-style matching patterns for each clause.
PowerShell✓ Tested
Embed a struct for shared fields
Embed a struct for shared fields using a complete Go program with explicit sample inputs.
Go✓ Tested