mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
builtin: add an Option2 struct (#8890)
This commit is contained in:
parent
18aecde9e5
commit
8033203ef6
5 changed files with 70 additions and 17 deletions
|
@ -7,12 +7,12 @@ const (
|
|||
)
|
||||
|
||||
pub struct Work {
|
||||
pub:
|
||||
pub:
|
||||
hours int
|
||||
}
|
||||
|
||||
pub struct Error {
|
||||
pub:
|
||||
pub struct MyError {
|
||||
pub:
|
||||
message string
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ pub fn do_work(){
|
|||
for i in 0..20 {
|
||||
println("working...")
|
||||
if i == 15 {
|
||||
error := &Error{"There was an error."}
|
||||
error := &MyError{"There was an error."}
|
||||
eb.publish("error", work, error)
|
||||
eb.publish("error", work, error)
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue