Hello
Is there a way to define a function but not implement it but use a kind of annotation/throw-statement instead? Like C#'s throw new NotImplementedException();
A very annoying problem I have already encountered several times is that I want to implement functions who are obligated by a trait. But I can't test/write them one-by-one because the compiler will complain not all obligated functions are implemented.
Code:
impl DataManager for MySQLData {
fn add(&mut self, cat : Cat) -> bool {true}
//fn read(&mut self) -> &std::vec::Vec<Cat> {}
//fn delete(&mut self, name : &String) -> bool {true}
//fn get(&mut self, name : &String) -> Option<&Cat> {None}
}
Error:
...
373 | impl DataManager for MySQLData {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing read
, delete
, get
in implementation
How can I let the compiler ignore that error? I want to implement the functions one by one...
I tried returning default values so the return type would match the function signature. But that's a hustle, waste of time, and annoying.
Maybe a kind of allow-attribute? Like #[allow(dead_code)]?