linuxfood created bindings for sqlite3 , for which I am grateful. I'm just starting to learn Rust (0.8), and I'm trying to figure out what this bit of code does:
extern mod sqlite;
fn db() {
let database =
match sqlite::open("test.db") {
Ok(db) => db,
Err(e) => {
println(fmt!("Error opening test.db: %?", e));
return;
}
};
I really understand what he is doing. It tries to get a database connection and also checks for an error. I do not understand how this is done.
To better understand this, I wanted to rewrite it without instructions match, but I have no knowledge for this. Is it possible? Does it return sqlite::open()two variables or only one?
How can this example be written in different ways without instruction match? I am not saying that this is necessary or preferable, but it can help me learn the language.