FIND YOUR NEXT FEW LINES

Results for “option”

Small, practical examples. Search by task or narrow things down below.

95 snippets foundClear filters
JavaNumbers & dates

Use an optional fallback

Use Optional.orElse to provide a default for a missing Java value.

Java✓ Tested
Docker / ComposeCompose service options

Add a fixed hostname mapping

Docker / Compose: extra_hosts adds an entry to the container’s hosts file.

Docker / Compose✓ Tested
RustErrors & optional values

Add context to a parsing failure

Add context to a parsing failure in a complete Rust program using the standard library.

Rust✓ Tested
C++Ownership & optional values

Apply an operation to a variant’s active value

C++: A generic visitor lets the compiler check behavior for every possible alternative.

C++✓ Tested
C++Ownership & optional values

Capture configuration by value in a callable

C++: A value capture retains the value from lambda creation even if the original variable changes later.

C++✓ Tested
RustErrors & optional values

Chain operations that may return None

Chain operations that may return None in a complete Rust program using the standard library.

Rust✓ Tested
Docker / ComposeCompose service options

Choose a service’s internal hostname

Docker / Compose: hostname controls the name reported inside the container.

Docker / Compose✓ Tested
Docker / ComposeCompose service options

Disable a service’s network interfaces

Docker / Compose: network_mode none leaves only the loopback interface.

Docker / Compose✓ Tested
Docker / ComposeCompose service options

Drop capabilities for a Compose service

Docker / Compose: cap_drop ALL removes optional Linux capabilities.

Docker / Compose✓ Tested
Docker / ComposeCompose service options

Enable an init process for a service

Docker / Compose: init adds a small PID 1 process to forward signals and reap children.

Docker / Compose✓ Tested
Docker / ComposeCompose service options

Give a read-only service writable scratch space

Docker / Compose: A tmpfs mount provides temporary storage independent of the root filesystem.

Docker / Compose✓ Tested
RustErrors & optional values

Handle integer overflow without panicking

Handle integer overflow without panicking in a complete Rust program using the standard library.

Rust✓ Tested