Successful

scodec.Attempt.Successful
case class Successful[A](value: A) extends Attempt[A]

Successful attempt.

Attributes

Source
Attempt.scala
Graph
Supertypes
class Attempt[A]
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def flatMap[B](f: A => Attempt[B]): Attempt[B]

Maps the supplied function over the successful value, if present.

Maps the supplied function over the successful value, if present.

Attributes

Source
Attempt.scala
def flatten[B](using ev: A <:< Attempt[B]): Attempt[B]

Converts an Attempt[Attempt[X]] in to an Attempt[X].

Converts an Attempt[Attempt[X]] in to an Attempt[X].

Attributes

Source
Attempt.scala
def fold[B](ifFailure: Err => B, ifSuccessful: A => B): B

Transforms this attempt to a value of type B using the supplied functions.

Transforms this attempt to a value of type B using the supplied functions.

Attributes

Source
Attempt.scala
def getOrElse[B >: A](default: => B): B

Returns the sucessful value if successful, otherwise the supplied default.

Returns the sucessful value if successful, otherwise the supplied default.

Attributes

Source
Attempt.scala
def isSuccessful: Boolean

True if attempt was successful.

True if attempt was successful.

Attributes

Source
Attempt.scala
def map[B](f: A => B): Attempt[B]

Maps the supplied function over the successful value, if present.

Maps the supplied function over the successful value, if present.

Attributes

Source
Attempt.scala
def mapErr(f: Err => Err): Attempt[A]

Maps the supplied function over the failure error, if present.

Maps the supplied function over the failure error, if present.

Attributes

Source
Attempt.scala
def orElse[B >: A](fallback: => Attempt[B]): Attempt[B]

Returns this attempt if successful, otherwise the fallback attempt.

Returns this attempt if successful, otherwise the fallback attempt.

Attributes

Source
Attempt.scala
def recover[B >: A](f: PartialFunction[Err, B]): Attempt[B]

If this attempt is a failure, and the supplied partial function is defined for the cause of the failure, a successful attempt is returned. If this attempt is successful or the supplied function is not defined for the cause of the failure, this attempt is returned unmodified.

If this attempt is a failure, and the supplied partial function is defined for the cause of the failure, a successful attempt is returned. If this attempt is successful or the supplied function is not defined for the cause of the failure, this attempt is returned unmodified.

Attributes

Source
Attempt.scala
def recoverWith[B >: A](f: PartialFunction[Err, Attempt[B]]): Attempt[B]

If this attempt is a failure, and the supplied partial function is defined for the cause of the failure, the result of applying that function is returned. If this attempt is successful or the supplied function is not defined for the cause of the failure, this attempt is returned unmodified.

If this attempt is a failure, and the supplied partial function is defined for the cause of the failure, the result of applying that function is returned. If this attempt is successful or the supplied function is not defined for the cause of the failure, this attempt is returned unmodified.

Attributes

Source
Attempt.scala
def require: A

Returns the successful value if present; otherwise throws an IllegalArgumentException.

Returns the successful value if present; otherwise throws an IllegalArgumentException.

Attributes

Source
Attempt.scala
def toEither: Right[Err, A]

Converts to an either.

Converts to an either.

Attributes

Source
Attempt.scala
def toOption: Some[A]

Converts to an option, discarding the error value.

Converts to an option, discarding the error value.

Attributes

Source
Attempt.scala
def toTry: Try[A]

Converts to a try.

Converts to a try.

Attributes

Source
Attempt.scala

Inherited methods

def isFailure: Boolean

True if attempt was not successful.

True if attempt was not successful.

Attributes

Inherited from:
Attempt
Source
Attempt.scala
def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product