mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
builtin,cgen: rename Option to _option (#14317)
This commit is contained in:
@@ -121,6 +121,23 @@ fn opt_ok(data voidptr, mut option Option, size int) {
|
||||
}
|
||||
}
|
||||
|
||||
// option is the base of V's internal optional return system.
|
||||
struct _option {
|
||||
state u8
|
||||
err IError = none__
|
||||
// Data is trailing after err
|
||||
// and is not included in here but in the
|
||||
// derived _option_xxx types
|
||||
}
|
||||
|
||||
fn opt_ok2(data voidptr, mut option _option, size int) {
|
||||
unsafe {
|
||||
*option = _option{}
|
||||
// use err to get the end of OptionBase and then memcpy into it
|
||||
vmemcpy(&u8(&option.err) + sizeof(IError), data, size)
|
||||
}
|
||||
}
|
||||
|
||||
struct _result {
|
||||
is_error bool
|
||||
err IError = none__
|
||||
|
||||
Reference in New Issue
Block a user