I am trying to make primitive types and object types by adding the new
method to usize
:
impl usize {
fn new(value: &u32) -> usize {
value as usize
}
}
I have no idea about what the message tries to say:
error[E0390]: only a single inherent implementation marked with `#[lang = "usize"]` is allowed for the `usize` primitive
--> src/lib.rs:1:1
|
1 | / impl usize {
2 | | fn new(value: &u32) -> usize {
3 | | value as usize
4 | | }
5 | | }
| |_^
|
help: consider using a trait to implement these methods
--> src/lib.rs:1:1
|
1 | / impl usize {
2 | | fn new(value: &u32) -> usize {
3 | | value as usize
4 | | }
5 | | }
| |_^