builtin: cleanup option names (part 2) (#9294)

pull/9300/head
spaceface 2021-03-14 11:11:52 +01:00 committed by GitHub
parent 8dc0e4d150
commit eebc8a9d7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 0 additions and 27 deletions

View File

@ -16,11 +16,6 @@ pub:
code int code int
} }
struct Option3 {
state byte
err IError = none__
}
const none__ = IError(&None__{}) const none__ = IError(&None__{})
struct None__ { struct None__ {
@ -30,28 +25,6 @@ struct None__ {
fn (_ None__) str() string { return '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`. // error returns a default error instance containing the error given in `message`.
// Example: `if ouch { return error('an error occurred') }` // Example: `if ouch { return error('an error occurred') }`
[inline] [inline]