Skip to content

Ok

Bases: ResultType[T, E]


              flowchart TD
              pyochain.core._result.Ok[Ok]
              pyochain.core._result.ResultType[ResultType]
              pyochain.abc._mixins.Pipe[Pipe]

                              pyochain.core._result.ResultType --> pyochain.core._result.Ok
                                pyochain.abc._mixins.Pipe --> pyochain.core._result.ResultType
                



              click pyochain.core._result.Ok href "" "pyochain.core._result.Ok"
              click pyochain.core._result.ResultType href "" "pyochain.core._result.ResultType"
              click pyochain.abc._mixins.Pipe href "" "pyochain.abc._mixins.Pipe"
            

Represents a successful value.

One of the two variants of Result[T, E], where T is the type of the value in Ok.

For more documentation, see the ResultType[T, E] Protocol.

Source code in pyochain/core/_result.pyi
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
@final
class Ok[T = Any, E = Any](ResultType[T, E]):
    """Represents a successful value.

    One of the two variants of `Result[T, E]`, where `T` is the type of the value in `Ok`.

    For more documentation, see the `ResultType[T, E]` Protocol.
    """

    value: Final[T]
    """Final[T]: The contained successful value."""

    __match_args__ = ("value",)
    # NOTE: this is an hack to avoid errors by immediatly casting `E` as `Any`, thus avoiding any type errors with incompatible types.
    def __new__(cls, value: T) -> Result[T, E]: ...

value instance-attribute

Final[T]: The contained successful value.