clone method

Result<T, E> clone()

Returns a new independent copy of this result.

Useful when you need to pass the result to multiple places without sharing state. Clones preserve error stack traces. For creating new results, prefer Ok or Err constructors directly.

Implementation

Result<T, E> clone() => switch (this) {
  Err<T, E>(:final error, :final stackTrace) => .err(error, stackTrace),
  Ok<T, E>(:final value) => .ok(value),
};