builtin: cleanup option names (part 2) (#9294)
parent
8dc0e4d150
commit
eebc8a9d7a
|
@ -16,11 +16,6 @@ pub:
|
|||
code int
|
||||
}
|
||||
|
||||
struct Option3 {
|
||||
state byte
|
||||
err IError = none__
|
||||
}
|
||||
|
||||
const none__ = IError(&None__{})
|
||||
|
||||
struct None__ {
|
||||
|
@ -30,28 +25,6 @@ struct None__ {
|
|||
|
||||
fn (_ None__) str() string { return 'none' }
|
||||
|
||||
fn opt_ok3(data voidptr, mut option Option3, size int) {
|
||||
unsafe {
|
||||
*option = Option3{}
|
||||
// use err to get the end of Option3 and then memcpy into it
|
||||
C.memcpy(byteptr(&option.err) + sizeof(IError), data, size)
|
||||
}
|
||||
}
|
||||
|
||||
[inline]
|
||||
pub fn error3(message string) IError {
|
||||
return &Error{
|
||||
msg: message
|
||||
}
|
||||
}
|
||||
|
||||
pub fn error_with_code3(message string, code int) IError {
|
||||
return &Error {
|
||||
msg: message
|
||||
code: code
|
||||
}
|
||||
}
|
||||
|
||||
// error returns a default error instance containing the error given in `message`.
|
||||
// Example: `if ouch { return error('an error occurred') }`
|
||||
[inline]
|
||||
|
|
Loading…
Reference in New Issue