]> crepu.dev Git - config.git/blame - djavu-asus/elpy/rpc-venv/lib/python3.11/site-packages/black/rusty.py
Configuracion en desarrollo PC pega
[config.git] / djavu-asus / elpy / rpc-venv / lib / python3.11 / site-packages / black / rusty.py
CommitLineData
53e6db90
DC
1"""An error-handling model influenced by that used by the Rust programming language
2
3See https://doc.rust-lang.org/book/ch09-00-error-handling.html.
4"""
5from typing import Generic, TypeVar, Union
6
7T = TypeVar("T")
8E = TypeVar("E", bound=Exception)
9
10
11class Ok(Generic[T]):
12 def __init__(self, value: T) -> None:
13 self._value = value
14
15 def ok(self) -> T:
16 return self._value
17
18
19class Err(Generic[E]):
20 def __init__(self, e: E) -> None:
21 self._e = e
22
23 def err(self) -> E:
24 return self._e
25
26
27Result = Union[Ok[T], Err[E]]