Member group
SingleOrError
Type: EnumerableOption<T>
Namespace: System.Linq
Assembly: Raven.Core.dll
Source file: LinqExtensions.rvn
Overloads / Variants
SingleOrError
static func SingleOrError<T, E>(self: IEnumerable<T>, errorFactory: () -> E) -> Result<T, E>
Source file: LinqExtensions.rvn
Returns the only element as Ok, or an error unless exactly one element exists.
SingleOrError
static func SingleOrError<T, E>(self: IEnumerable<T>, errorIfNone: () -> E, errorIfMany: () -> E) -> Result<T, E>
Source file: LinqExtensions.rvn
Returns the only element as Ok, distinguishing empty and multiple-element errors.
SingleOrError
static func SingleOrError<T, E>(self: IEnumerable<T>, predicate: T -> bool, errorFactory: () -> E) -> Result<T, E>
Source file: LinqExtensions.rvn
Returns the only matching element as Ok, or an error unless exactly one element matches.
SingleOrError
static func SingleOrError<T, E>(self: IEnumerable<T>, predicate: T -> bool, errorIfNone: () -> E, errorIfMany: () -> E) -> Result<T, E>
Source file: LinqExtensions.rvn
Returns the only matching element as Ok, distinguishing no-match and multiple-match errors.