error when use type variant in Rust struct

40 Views Asked by At

I want to use type in struct but I get error

pub struct Hello {
    pub type: String,
}

and I got this error

Syntax Error: expected COLON rust-analyzersyntax-error
Syntax Error: expected type rust-analyzersyntax-error
Field `String` should have snake_case name, e.g. `string` rust-analyzernon_snake_case

I want to use type and I don't now how to use field with name type in struct ??

0

There are 0 best solutions below