case class Success[A] extends Result[Nothing, A] with Product with Serializable
This class is used for when a parser succeeds, and contains its result.
- A
the type of expected success result.
- Source
- Result.scala
- Alphabetic
- By Inheritance
- Success
- Serializable
- Product
- Equals
- Result
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
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()
- def contains[B >: A](elem: B): Boolean
Returns
trueif this result is aSuccessand its value is equal toelem(as determined by==), returnsfalseotherwise.Returns
trueif this result is aSuccessand its value is equal toelem(as determined by==), returnsfalseotherwise.- elem
the element to test.
- returns
trueif this is aSuccessvalue equal toelem.
- Definition Classes
- Result
- Since
1.7.0
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def exists(p: (A) => Boolean): Boolean
Returns
falseifFailureor returns the result of the application of the given predicate to theSuccessvalue.Returns
falseifFailureor returns the result of the application of the given predicate to theSuccessvalue.- Definition Classes
- Result
- Since
1.7.0
- def filterOrElse[Errʹ >: Nothing](p: (A) => Boolean, msg: => Errʹ): Result[Errʹ, A]
Returns
Successwith the existing value ofSuccessif this is aSuccessand the given predicatepholds for the right value, orFailure(msg)if this is aSuccessand the given predicatepdoes not hold for the right value, orFailurewith the existing value ofFailureif this is aFailure.Returns
Successwith the existing value ofSuccessif this is aSuccessand the given predicatepholds for the right value, orFailure(msg)if this is aSuccessand the given predicatepdoes not hold for the right value, orFailurewith the existing value ofFailureif this is aFailure.- Definition Classes
- Result
- Since
1.7.0
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def flatMap[B, Errʹ >: Nothing](f: (A) => Result[Errʹ, B]): Result[Errʹ, B]
Returns the result of applying
fto this result if it is a success.Returns the result of applying
fto this result if it is a success. Returns a failure if this result is a failure. Differs frommapasfreturns a result instead of just a value.- Definition Classes
- Result
- Since
1.7.0
- def flatten[B, Errʹ >: Nothing](implicit ev: <:<[A, Result[Errʹ, B]]): Result[Errʹ, B]
Returns the nested result if this result is a success, otherwise return this failure.
Returns the nested result if this result is a success, otherwise return this failure.
Equivalent to
flatMap(identity[Result[Errʹ, B]]).- Definition Classes
- Result
- Since
1.7.0
- def fold[B](ferr: (Nothing) => B, fa: (A) => B): B
Returns the result of applying
ferrto this result's error if this is aFailureorfato the result stored in theSuccessotherwise.Returns the result of applying
ferrto this result's error if this is aFailureorfato the result stored in theSuccessotherwise.- ferr
the function to apply if this is a
Failure.- fa
the function to apply if this is a
Success.- returns
the results of applying the function
- Definition Classes
- Result
- Since
1.7.0
- def forall(f: (A) => Boolean): Boolean
Returns
trueif this result is aFailureor returns the result of the application of the given predicate to theSuccessvalue.Returns
trueif this result is aFailureor returns the result of the application of the given predicate to theSuccessvalue.- Definition Classes
- Result
- Since
1.7.0
- def foreach[U](f: (A) => U): Unit
Executes the procedure
fif this is aSuccess.Executes the procedure
fif this is aSuccess. Otherwise, do nothing.This is equivalent to:
result match { case Success(x) => f(x) case _ => () }
- f
The side-effecting function to execute.
- Definition Classes
- Result
- Since
1.7.0
- def get: A
Returns the successful value within the result.
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def getOrElse[B >: A](default: => B): B
Returns the value from this
Successor the result of evaluatingdefaultif this is aFailure.Returns the value from this
Successor the result of evaluatingdefaultif this is aFailure.- Definition Classes
- Result
- Since
1.7.0
- def isFailure: Boolean
Returns
trueif this is aFailure,falseotherwise. - final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isSuccess: Boolean
Returns
trueif this is aSuccess,falseotherwise. - def map[B](f: (A) => B): Result[Nothing, B]
Returns a
Successcontaining the result of applyingfto this result's value if this is a success.Returns a
Successcontaining the result of applyingfto this result's value if this is a success. Otherwise, returns a failure.- Definition Classes
- Result
- Since
1.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()
- def orElse[B >: A, Errʹ >: Nothing](alternative: => Result[Errʹ, B]): Result[Errʹ, B]
Returns this result if it is a
Success, otherwise return the result of evaluatingalternative.Returns this result if it is a
Success, otherwise return the result of evaluatingalternative.- Definition Classes
- Result
- Since
1.7.0
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toEither: Either[Nothing, A]
Converts the
Resultinto aEitherwhereFailuremaps to aLeft[Err].Converts the
Resultinto aEitherwhereFailuremaps to aLeft[Err].- Definition Classes
- Result
- Since
1.7.0
- def toOption: Option[A]
Returns a
Somecontaining theSuccessvalue if it exists or aNoneif this is aFailure.Returns a
Somecontaining theSuccessvalue if it exists or aNoneif this is aFailure.- Definition Classes
- Result
- Since
1.7.0
- def toSeq: Seq[A]
Returns a
Seqcontaining theSuccessvalue if it exists or an emptySeqif this is aFailure.Returns a
Seqcontaining theSuccessvalue if it exists or an emptySeqif this is aFailure.- Definition Classes
- Result
- Since
1.7.0
- def toTry: Try[A]
Converts the
Resultinto aTrywhereFailuremaps to a plainException.Converts the
Resultinto aTrywhereFailuremaps to a plainException.- Definition Classes
- Result
- Since
1.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()
- val x: A