object Result
- Alphabetic
- By Inheritance
- Result
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- final case class Errors(errors: NonEmptyErrorsChain) extends Result[Nothing] with Product with Serializable
Errors case representation
Errors case representation
- errors
non-empty collection of path-annotated errors
- Since
0.7.0
- final case class Value[T](value: T) extends Result[T] with Product with Serializable
Success value case representation
Success value case representation
- T
type of success value
- value
value of type
T
- Since
0.7.0
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def fromCatching[T](value: => T): Result[T]
Converts possibly throwing computation into Result.
Converts possibly throwing computation into Result.
- T
type of successful result
- value
computation to run while catching its exceptions
- returns
successful Result if computation didn't throw, failed Result with caught exception if it threw
- Since
0.7.0
- final def fromEither[T](value: Either[Errors, T]): Result[T]
Converts Either to Result, using Errors from Left as failed result.
Converts Either to Result, using Errors from Left as failed result.
- T
type of successful result
- value
Either to convert
- returns
successful result if scala.Right, failed result if scala.Left
- Since
0.7.0
- final def fromEitherString[T](value: Either[String, T]): Result[T]
Converts Either to Result, using an error message from Left as failed result.
Converts Either to Result, using an error message from Left as failed result.
- T
type of successful result
- value
Either to convert
- returns
successful result if scala.Right, failed result with an error message if scala.Left
- Since
0.7.0
- final def fromEmpty[T]: Result[T]
Creates failed Result with an empty value error.
Creates failed Result with an empty value error.
- T
type of successful result
- returns
failed result
- Since
0.7.0
- final def fromError[T](error: Error): Result[T]
Creates failed result from a single error.
Creates failed result from a single error.
- T
type of successful result
- error
required error
- returns
result containing one error
- Since
0.7.0
- final def fromErrorNotDefinedAt[T](value: Any): Result[T]
Creates failed result from argument for which PartialFunction was not defined.
Creates failed result from argument for which PartialFunction was not defined.
- T
type of successful result
- value
value for which partial function was not defined
- returns
result containing one error
- Since
0.7.0
- final def fromErrorString[T](message: String): Result[T]
Creates failed result from an error message.
Creates failed result from an error message.
- T
type of successful result
- message
message to wrap in Error
- returns
result containing one error
- Since
0.7.0
- final def fromErrorStrings[T](message: String, messages: String*): Result[T]
Creates failed result from one error message or more.
Creates failed result from one error message or more.
- T
type of successful result
- message
required message to wrap in Error
- messages
optional messages to wrap in Error
- returns
result aggregating all passed errors
- Since
0.7.0
- final def fromErrorThrowable[T](throwable: Throwable): Result[T]
Creates failed result from Exception that was caught.
Creates failed result from Exception that was caught.
- T
type of successful result
- throwable
exception
- returns
result containing one error
- Since
0.7.0
- final def fromErrors[T](error: Error, errors: Error*): Result[T]
Creates failed result from one error or more.
Creates failed result from one error or more.
- T
type of successful result
- error
required head io.scalaland.chimney.partial.Error
- errors
optional tail io.scalaland.chimney.partial.Errors
- returns
result aggregating all passed errors
- Since
0.7.0
- final def fromFunction[S, T](f: (S) => T): (S) => Result[T]
Converts a function that throws Exceptions into function that returns Result.
Converts a function that throws Exceptions into function that returns Result.
- S
input type
- T
output type
- f
function that possibly throws
- returns
function that caches Exceptions as failed results
- Since
0.7.0
- final def fromOption[T](value: Option[T]): Result[T]
Converts Option to Result, using EmptyValue error if None.
Converts Option to Result, using EmptyValue error if None.
- T
type of successful result
- value
Option to convert
- returns
successful result if scala.Some, failed result with EmptyValue error if None
- Since
0.7.0
- final def fromOptionOrError[T](value: Option[T], ifEmpty: => Error): Result[T]
Converts Option to Result, using provided Error if None.
Converts Option to Result, using provided Error if None.
- T
type of successful result
- value
Option to convert
- ifEmpty
lazy error for scala.None
- returns
successful result if scala.Some, failed result with provided error if scala.None
- Since
0.7.0
- final def fromOptionOrString[T](value: Option[T], ifEmpty: => String): Result[T]
Converts Option to Result, using provided error message if None.
Converts Option to Result, using provided error message if None.
- T
type of successful result
- value
Option to convert
- ifEmpty
lazy error message for scala.None
- returns
successful result if scala.Some, failed result with provided error message if scala.None
- Since
0.7.0
- final def fromOptionOrThrowable[T](value: Option[T], ifEmpty: => Throwable): Result[T]
Converts Option to Result, using provided Throwable if None.
Converts Option to Result, using provided Throwable if None.
- T
type of successful result
- value
Option to convert
- ifEmpty
lazy error for scala.None
- returns
successful result if scala.Some, failed result with provided Throwable if scala.None
- Since
0.7.0
- final def fromPartialFunction[S, T](pf: PartialFunction[S, T]): (S) => Result[T]
Converts a partial function that throws Exceptions into function that returns Result.
Converts a partial function that throws Exceptions into function that returns Result.
- S
input type
- T
output type
- pf
partial function that possibly throws
- returns
function that caches Exceptions and arguments without defined value as failed Results
- Since
0.7.0
- final def fromTry[T](value: Try[T]): Result[T]
Converts Try to Result, using Throwable from Failure as failed result.
Converts Try to Result, using Throwable from Failure as failed result.
- T
type of successful result
- value
Try to convert
- returns
successful result if scala.util.Success, failed result with Throwable if scala.util.Failure
- Since
0.7.0
- final def fromValue[T](value: T): Result[T]
Creates successful Result from a precomputed value.
Creates successful Result from a precomputed value.
- T
type of sucessful value
- value
successful value to return in result
- returns
successful result
- Since
0.7.0
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def map2[A, B, C](resultA: Result[A], resultB: => Result[B], f: (A, B) => C, failFast: Boolean): Result[C]
Combines 2 Results into 1 by combining their successful values or aggregating errors.
Combines 2 Results into 1 by combining their successful values or aggregating errors.
- A
first successful input type
- B
second successful input type
- C
successful output type
- resultA
first Result
- resultB
second Result
- f
function combining 2 successful input values into successful output value
- failFast
whether conversion should stop at first failed element or should it aggregate errors from both Results
- returns
successful Result of combination if both results were successful, failed result if at least one of Result were failure
- Since
0.7.0
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def product[A, B](resultA: Result[A], resultB: => Result[B], failFast: Boolean): Result[(A, B)]
Combines 2 Results into 1 by tupling their successful values or aggregating errors.
Combines 2 Results into 1 by tupling their successful values or aggregating errors.
- A
first successful input type
- B
second successful input type
- resultA
first Result
- resultB
second Result
- failFast
whether conversion should stop at first failed element or should it aggregate errors from both Results
- returns
successful Result with a tuple if both results were successful, failed result if at least one of Result were failure
- Since
0.7.0
- final def sequence[M, A](it: Iterator[Result[A]], failFast: Boolean)(implicit fac: Factory[A, M]): Result[M]
Converts an Iterator containing Results into a Result with selected collection of successful values.
Converts an Iterator containing Results into a Result with selected collection of successful values.
- M
type of output - output collection of output element
- A
type of successful values in Results
- it
iterator with Results to aggregate
- failFast
whether conversion should stop at first failed element conversion or should it continue to aggregate all errors
- fac
factory of output type
- returns
result with user-selected collection of converted elements if all conversions succeeded, result with conversion errors if at least one conversion failed
- Since
0.7.0
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def traverse[M, A, B](it: Iterator[A], f: (A) => Result[B], failFast: Boolean)(implicit fac: Factory[B, M]): Result[M]
Converts an Iterator of input type into selected collection of output type, aggregating errors from conversions of individual elements.
Converts an Iterator of input type into selected collection of output type, aggregating errors from conversions of individual elements.
- M
type of output - output collection of output element
- A
type of elements of input
- B
type of elements of output
- it
iterator with elements to convert
- f
function converting each individual element to Result
- failFast
whether conversion should stop at first failed element conversion or should it continue to aggregate all errors
- fac
factory of output type
- returns
result with user-selected collection of converted elements if all conversions succeeded, result with conversion errors if at least one conversion failed
- Since
0.7.0
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- object Errors extends Serializable