``IOSuccess`` representation.
| 851 | |
| 852 | @final |
| 853 | class IOSuccess(IOResult[_ValueType_co, Any]): |
| 854 | """``IOSuccess`` representation.""" |
| 855 | |
| 856 | __slots__ = () |
| 857 | |
| 858 | _inner_value: Result[_ValueType_co, Any] |
| 859 | |
| 860 | def __init__(self, inner_value: _ValueType_co) -> None: |
| 861 | """IOSuccess constructor.""" |
| 862 | super().__init__(Success(inner_value)) |
| 863 | |
| 864 | if not TYPE_CHECKING: # noqa: WPS604 # pragma: no branch |
| 865 | |
| 866 | def bind(self, function): |
| 867 | """Composes this container with a function returning ``IOResult``.""" # noqa: E501 |
| 868 | return function(self._inner_value.unwrap()) |
| 869 | |
| 870 | #: Alias for `bind_ioresult` method. Part of the `IOResultBasedN` interface. # noqa: E501 |
| 871 | bind_ioresult = bind |
| 872 | |
| 873 | def bind_result(self, function): |
| 874 | """Binds ``Result`` returning function to current container.""" |
| 875 | return self.from_result(function(self._inner_value.unwrap())) |
| 876 | |
| 877 | def bind_io(self, function): |
| 878 | """Binds ``IO`` returning function to current container.""" |
| 879 | return self.from_io(function(self._inner_value.unwrap())) |
| 880 | |
| 881 | def lash(self, function): |
| 882 | """Does nothing for ``IOSuccess``.""" |
| 883 | return self |
| 884 | |
| 885 | |
| 886 | # Aliases: |
no outgoing calls