ThenOptional
Consumes one wrapper and invokes its safe callback only for the selected case.
Module std.prelude
import std.prelude;Public declaration contracts and authored examples. A page can document several related symbols. Implementation bodies are excluded.
ThenOptional
pub fn ThenOptional<T, U>(mut Value: T?, Mapper: fn(T) -> U?) -> U?
where T: Movable where U: MovableConsumes one wrapper and invokes its safe callback only for the selected case.
Unselected owned payloads transfer without copying. The callback is invoked exactly once for the selected case and never for the other case; callback captures/costs keep their own contract. This helper adds no allocation, synchronization or implicit error propagation. Reference payloads remain aliases. T: Exact movable payload representation. U: Exact movable payload representation. Value: Owned wrapper consumed by this call; explicitly move noncopy named inputs. Mapper: Nonnullable safe callback with exact input/output types. Return: Flattened selected callback result or preserved opposite case.
ThenOptional
pub fn ThenOptional<T, U, C>(mut Value: T?, mut Mapper: C) -> U?
where T: Movable where U: Movable where C: UnaryCallable<T, U?>, MovableConsumes one wrapper and invokes its safe callback only for the selected case.
Unselected owned payloads transfer without copying. The callback is invoked exactly once for the selected case and never for the other case; callback captures/costs keep their own contract. This helper adds no allocation, synchronization or implicit error propagation. Reference payloads remain aliases. T: Exact movable payload representation. U: Exact movable payload representation. C: Concrete movable exact safe readonly callback environment. Value: Owned wrapper consumed by this call; explicitly move noncopy named inputs. Mapper: Owned concrete safe callback with exact input/output types. Return: Flattened selected callback result or preserved opposite case.