mirror of
https://github.com/fluencelabs/sqlite-wasm-connector
synced 2025-03-15 06:20:50 +00:00
Adjust the formatting of the macros
This commit is contained in:
parent
742837660d
commit
9aba31e37c
68
src/lib.rs
68
src/lib.rs
@ -115,27 +115,33 @@ macro_rules! raise(
|
||||
);
|
||||
|
||||
macro_rules! error(
|
||||
($connection:expr, $code:expr) => (match ::last_error($connection) {
|
||||
Some(error) => return Err(error),
|
||||
_ => return Err(::Error {
|
||||
code: Some($code as isize),
|
||||
message: None,
|
||||
}),
|
||||
});
|
||||
($connection:expr, $code:expr) => (
|
||||
match ::last_error($connection) {
|
||||
Some(error) => return Err(error),
|
||||
_ => return Err(::Error {
|
||||
code: Some($code as isize),
|
||||
message: None,
|
||||
}),
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
macro_rules! ok(
|
||||
($connection:expr, $result:expr) => (match $result {
|
||||
::ffi::SQLITE_OK => {}
|
||||
code => error!($connection, code),
|
||||
});
|
||||
($result:expr) => (match $result {
|
||||
::ffi::SQLITE_OK => {}
|
||||
code => return Err(::Error {
|
||||
code: Some(code as isize),
|
||||
message: None,
|
||||
}),
|
||||
});
|
||||
($connection:expr, $result:expr) => (
|
||||
match $result {
|
||||
::ffi::SQLITE_OK => {}
|
||||
code => error!($connection, code),
|
||||
}
|
||||
);
|
||||
($result:expr) => (
|
||||
match $result {
|
||||
::ffi::SQLITE_OK => {}
|
||||
code => return Err(::Error {
|
||||
code: Some(code as isize),
|
||||
message: None,
|
||||
}),
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
macro_rules! c_str_to_str(
|
||||
@ -150,22 +156,26 @@ macro_rules! c_str_to_string(
|
||||
);
|
||||
|
||||
macro_rules! path_to_cstr(
|
||||
($path:expr) => (match $path.to_str() {
|
||||
Some(path) => {
|
||||
match ::std::ffi::CString::new(path) {
|
||||
Ok(string) => string,
|
||||
_ => raise!("failed to process a path"),
|
||||
($path:expr) => (
|
||||
match $path.to_str() {
|
||||
Some(path) => {
|
||||
match ::std::ffi::CString::new(path) {
|
||||
Ok(string) => string,
|
||||
_ => raise!("failed to process a path"),
|
||||
}
|
||||
}
|
||||
_ => raise!("failed to process a path"),
|
||||
}
|
||||
_ => raise!("failed to process a path"),
|
||||
});
|
||||
);
|
||||
);
|
||||
|
||||
macro_rules! str_to_cstr(
|
||||
($string:expr) => (match ::std::ffi::CString::new($string) {
|
||||
Ok(string) => string,
|
||||
_ => raise!("failed to process a string"),
|
||||
});
|
||||
($string:expr) => (
|
||||
match ::std::ffi::CString::new($string) {
|
||||
Ok(string) => string,
|
||||
_ => raise!("failed to process a string"),
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
/// An error.
|
||||
|
@ -5,7 +5,9 @@ use std::marker::PhantomData;
|
||||
use {Cursor, Result, Type, Value};
|
||||
|
||||
// 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.
|
||||
pub struct Statement<'l> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user