Results for “read file”
Small, practical examples. Search by task or narrow things down below.
Move a collection out and leave an empty default
Move a collection out and leave an empty default in a complete Rust program using the standard library.
Rust✓ Tested
Mutate a struct through a pointer receiver
Mutate a struct through a pointer receiver using a complete Go program with explicit sample inputs.
Go✓ Tested
Name a fixed configuration value
Name a fixed configuration value using a complete Go program with explicit sample inputs.
Go✓ Tested
Name a value that stays fixed
C++: Use a constant declaration or the language’s constant naming convention for a fixed limit.
C++✓ Tested
Number a sorted result
Assign a row number without changing stored data.
row_number✓ Tested
Number items while iterating
Number items while iterating in a complete Rust program using the standard library.
Rust✓ Tested
Observe an exception from an asynchronous task
C++: Calling get rethrows an exception captured by the future.
C++✓ Tested
Observe context cancellation
Observe context cancellation using a complete Go program with explicit sample inputs.
Go✓ Tested
Observe shared ownership without extending its lifetime
C++: A weak_ptr can be locked while an owner exists and becomes expired after the last owner is released.
C++✓ Tested
Override the image entrypoint in Compose
Docker / Compose: entrypoint and command combine as executable and arguments.
Docker / Compose✓ Tested
Own a heap-allocated value with Box
Own a heap-allocated value with Box in a complete Rust program using the standard library.
Rust✓ Tested
Own one dynamically allocated value with unique_ptr
C++: make_unique allocates a value whose lifetime is tied to its owning smart pointer.
C++✓ Tested