Rename to op
This commit is contained in:
17
src/oi.nim
17
src/oi.nim
@@ -1,17 +0,0 @@
|
||||
type
|
||||
Err = string
|
||||
OI*[T] = object of RootObj
|
||||
case isOk*: bool
|
||||
of true:
|
||||
val*: T
|
||||
of false:
|
||||
error*: string
|
||||
|
||||
proc ok*[T](val: T): OI[T] =
|
||||
OI[T](isOK: true, val: val)
|
||||
|
||||
proc fail*(oi: OI, msg: string): OI =
|
||||
OI(isOK: false, error: msg)
|
||||
|
||||
proc fail*[T](msg: string): OI[T] =
|
||||
OI[T](isOK: false, error: msg)
|
||||
17
src/op.nim
Normal file
17
src/op.nim
Normal file
@@ -0,0 +1,17 @@
|
||||
type
|
||||
OP*[T] = object of RootObj
|
||||
case isOk*: bool
|
||||
of true:
|
||||
val*: T
|
||||
of false:
|
||||
error*: string
|
||||
|
||||
proc ok*[T](val: T): OP[T] =
|
||||
OP[T](isOK: true, val: val)
|
||||
|
||||
proc fail*(op: OP, msg: string): OP =
|
||||
OP(isOK: false, error: msg)
|
||||
|
||||
proc fail*[T](msg: string): OP[T] =
|
||||
OP[T](isOK: false, error: msg)
|
||||
|
||||
Reference in New Issue
Block a user