mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-23 14:55:19 +00:00
Let custom formatter example pass -vet-tabs if copied
This commit is contained in:
@@ -10,14 +10,14 @@ SomeType :: struct {
|
||||
My_Custom_Base_Type :: distinct u32
|
||||
|
||||
main :: proc() {
|
||||
// Ensure the fmt._user_formatters map is initialized
|
||||
// Ensure the fmt._user_formatters map is initialized
|
||||
fmt.set_user_formatters(new(map[typeid]fmt.User_Formatter))
|
||||
|
||||
// Register custom formatters for my favorite types
|
||||
err := fmt.register_user_formatter(type_info_of(SomeType).id, SomeType_Formatter)
|
||||
assert(err == .None)
|
||||
assert(err == .None)
|
||||
err = fmt.register_user_formatter(type_info_of(My_Custom_Base_Type).id, My_Custom_Base_Formatter)
|
||||
assert(err == .None)
|
||||
assert(err == .None)
|
||||
|
||||
// Use the custom formatters.
|
||||
fmt.printfln("SomeType{{42}}: '%v'", SomeType{42})
|
||||
@@ -53,5 +53,4 @@ My_Custom_Base_Formatter :: proc(fi: ^fmt.Info, arg: any, verb: rune) -> bool {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user