Errors while trying basic programs

 if _value.parse::<u32>().is_ok() {
           methods::maximum(required_col);       }
   | |______^ expected enum `std::result::Result`, found `()`

When i call method by importing module to main function in if block it is showing me this error.

And also,

      if _value.parse::<u32>().is_ok() {
                ^^^^^ method not found in `u32

I used this condition to check whether my value is of type u32 or not .
Could you please help me out to solve these errors

parse is used to transform a string into a number (like u32).

From the error, it sounds like you already have a number, so you don't need to call "parse." Rust variables have types that are known at compile time, so you don't need to call functions to check their types.

Without seeing your whole function, I can’t really tell you how to fix it. Please paste a more complete example or share a link from the playground if you have more questions.

ok

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.