mirror of
https://github.com/fluencelabs/sqlite-wasm-connector
synced 2025-04-25 08:42:14 +00:00
Adjust the formatting of the macros
This commit is contained in:
parent
742837660d
commit
9aba31e37c
30
src/lib.rs
30
src/lib.rs
@ -115,27 +115,33 @@ macro_rules! raise(
|
|||||||
);
|
);
|
||||||
|
|
||||||
macro_rules! error(
|
macro_rules! error(
|
||||||
($connection:expr, $code:expr) => (match ::last_error($connection) {
|
($connection:expr, $code:expr) => (
|
||||||
|
match ::last_error($connection) {
|
||||||
Some(error) => return Err(error),
|
Some(error) => return Err(error),
|
||||||
_ => return Err(::Error {
|
_ => return Err(::Error {
|
||||||
code: Some($code as isize),
|
code: Some($code as isize),
|
||||||
message: None,
|
message: None,
|
||||||
}),
|
}),
|
||||||
});
|
}
|
||||||
|
);
|
||||||
);
|
);
|
||||||
|
|
||||||
macro_rules! ok(
|
macro_rules! ok(
|
||||||
($connection:expr, $result:expr) => (match $result {
|
($connection:expr, $result:expr) => (
|
||||||
|
match $result {
|
||||||
::ffi::SQLITE_OK => {}
|
::ffi::SQLITE_OK => {}
|
||||||
code => error!($connection, code),
|
code => error!($connection, code),
|
||||||
});
|
}
|
||||||
($result:expr) => (match $result {
|
);
|
||||||
|
($result:expr) => (
|
||||||
|
match $result {
|
||||||
::ffi::SQLITE_OK => {}
|
::ffi::SQLITE_OK => {}
|
||||||
code => return Err(::Error {
|
code => return Err(::Error {
|
||||||
code: Some(code as isize),
|
code: Some(code as isize),
|
||||||
message: None,
|
message: None,
|
||||||
}),
|
}),
|
||||||
});
|
}
|
||||||
|
);
|
||||||
);
|
);
|
||||||
|
|
||||||
macro_rules! c_str_to_str(
|
macro_rules! c_str_to_str(
|
||||||
@ -150,7 +156,8 @@ macro_rules! c_str_to_string(
|
|||||||
);
|
);
|
||||||
|
|
||||||
macro_rules! path_to_cstr(
|
macro_rules! path_to_cstr(
|
||||||
($path:expr) => (match $path.to_str() {
|
($path:expr) => (
|
||||||
|
match $path.to_str() {
|
||||||
Some(path) => {
|
Some(path) => {
|
||||||
match ::std::ffi::CString::new(path) {
|
match ::std::ffi::CString::new(path) {
|
||||||
Ok(string) => string,
|
Ok(string) => string,
|
||||||
@ -158,14 +165,17 @@ macro_rules! path_to_cstr(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => raise!("failed to process a path"),
|
_ => raise!("failed to process a path"),
|
||||||
});
|
}
|
||||||
|
);
|
||||||
);
|
);
|
||||||
|
|
||||||
macro_rules! str_to_cstr(
|
macro_rules! str_to_cstr(
|
||||||
($string:expr) => (match ::std::ffi::CString::new($string) {
|
($string:expr) => (
|
||||||
|
match ::std::ffi::CString::new($string) {
|
||||||
Ok(string) => string,
|
Ok(string) => string,
|
||||||
_ => raise!("failed to process a string"),
|
_ => raise!("failed to process a string"),
|
||||||
});
|
}
|
||||||
|
);
|
||||||
);
|
);
|
||||||
|
|
||||||
/// An error.
|
/// An error.
|
||||||
|
@ -5,7 +5,9 @@ use std::marker::PhantomData;
|
|||||||
use {Cursor, Result, Type, Value};
|
use {Cursor, Result, Type, Value};
|
||||||
|
|
||||||
// https://sqlite.org/c3ref/c_static.html
|
// https://sqlite.org/c3ref/c_static.html
|
||||||
macro_rules! transient(() => (::std::mem::transmute(!0 as *const ::libc::c_void)));
|
macro_rules! transient(
|
||||||
|
() => (::std::mem::transmute(!0 as *const ::libc::c_void));
|
||||||
|
);
|
||||||
|
|
||||||
/// A prepared statement.
|
/// A prepared statement.
|
||||||
pub struct Statement<'l> {
|
pub struct Statement<'l> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user