Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUST

armanriazi•rust•error•[E0308]: mismatched types expected integer, found floating-point number

//Resolved by adding U
struct Point<T, U> {
    x: T,
    y: U,
}

fn main() {
    let both_integer = Point { x: 5, y: 10 };
    let both_float = Point { x: 1.0, y: 4.0 };
    let integer_and_float = Point { x: 5, y: 4.0 };
}
 
PREVIOUS NEXT
Tagged: #mismatched #types #expected #number
ADD COMMENT
Topic
Name
7+6 =