remove externs

This commit is contained in:
vms 2021-09-03 18:08:45 +03:00
parent 6f4e0c2d4f
commit e4da5c0d4b
6 changed files with 16 additions and 20 deletions

View File

@ -1,10 +1,9 @@
use crate::sqlite3_connector as ffi; use crate::sqlite3_connector as ffi;
use crate::{Result, Statement};
use std::marker::PhantomData; use std::marker::PhantomData;
use std::path::Path; use std::path::Path;
use crate::{Result, Statement};
/// A database connection. /// A database connection.
pub struct Connection { pub struct Connection {
raw: ffi::Sqlite3DbHandle, raw: ffi::Sqlite3DbHandle,

View File

@ -1,8 +1,6 @@
#![allow(unused_variables)] #![allow(unused_variables)]
#![allow(non_snake_case)] #![allow(non_snake_case)]
extern crate marine_rs_sdk;
use marine_rs_sdk::marine; use marine_rs_sdk::marine;
pub fn main() {} pub fn main() {}

View File

@ -1,6 +1,4 @@
extern crate marine_rs_sdk; use marine_rs_sdk::marine;
use self::marine_rs_sdk::marine;
pub(crate) type Sqlite3DbHandle = u32; pub(crate) type Sqlite3DbHandle = u32;
pub(crate) type Sqlite3StmtHandle = u32; pub(crate) type Sqlite3StmtHandle = u32;

View File

@ -1,8 +1,8 @@
use crate::sqlite3_connector as ffi; use crate::sqlite3_connector as ffi;
use std::marker::PhantomData;
use crate::{Cursor, Result, Type, Value}; use crate::{Cursor, Result, Type, Value};
use std::marker::PhantomData;
/// A prepared statement. /// A prepared statement.
pub struct Statement { pub struct Statement {
raw: (ffi::Sqlite3StmtHandle, ffi::Sqlite3DbHandle), raw: (ffi::Sqlite3StmtHandle, ffi::Sqlite3DbHandle),

View File

@ -1,6 +1,3 @@
extern crate marine_rs_sdk;
extern crate marine_sqlite_connector;
use marine_rs_sdk::marine; use marine_rs_sdk::marine;
use marine_sqlite_connector::State; use marine_sqlite_connector::State;
@ -100,7 +97,8 @@ pub fn test4() {
.unwrap(); .unwrap();
let mut cursor = connection let mut cursor = connection
.prepare("INSERT OR REPLACE INTO test VALUES (?, ?)").unwrap(); .prepare("INSERT OR REPLACE INTO test VALUES (?, ?)")
.unwrap();
cursor.bind(1, &Value::Integer(50)).unwrap(); cursor.bind(1, &Value::Integer(50)).unwrap();
cursor.bind(2, &Value::Binary(vec![1, 2, 3])).unwrap(); cursor.bind(2, &Value::Binary(vec![1, 2, 3])).unwrap();
@ -123,7 +121,8 @@ pub fn test5() {
.unwrap(); .unwrap();
let mut cursor = connection let mut cursor = connection
.prepare("INSERT OR REPLACE INTO test VALUES (?, ?)").unwrap(); .prepare("INSERT OR REPLACE INTO test VALUES (?, ?)")
.unwrap();
cursor.bind(1, &Value::Integer(50)).unwrap(); cursor.bind(1, &Value::Integer(50)).unwrap();
cursor.bind(2, &Value::Binary(vec![1, 2, 3])).unwrap(); cursor.bind(2, &Value::Binary(vec![1, 2, 3])).unwrap();
@ -138,8 +137,12 @@ pub fn test5() {
cursor.bind(&[Value::Integer(50)]).unwrap(); cursor.bind(&[Value::Integer(50)]).unwrap();
while let Some(row) = cursor.next().unwrap() { while let Some(row) = cursor.next().unwrap() {
if vec![1,2 ,3] != row[0].as_binary().unwrap().to_vec() { if vec![1, 2, 3] != row[0].as_binary().unwrap().to_vec() {
println!("expected: {:?}, actual: {:?}", vec![1,2 ,3], row[0].as_binary().unwrap()); println!(
"expected: {:?}, actual: {:?}",
vec![1, 2, 3],
row[0].as_binary().unwrap()
);
} }
} }
} }

View File

@ -29,13 +29,11 @@ mod tests {
test.test2() test.test2()
} }
#[marine_test(config_path = "../Config.toml", modules_dir = "../artifacts/")] #[marine_test(config_path = "../Config.toml", modules_dir = "../artifacts/")]
fn test3(test: marine_test_env::test::ModuleInterface) { fn test3(test: marine_test_env::test::ModuleInterface) {
test.test3() test.test3()
} }
#[marine_test(config_path = "../Config.toml", modules_dir = "../artifacts/")] #[marine_test(config_path = "../Config.toml", modules_dir = "../artifacts/")]
fn test4(test: marine_test_env::test::ModuleInterface) { fn test4(test: marine_test_env::test::ModuleInterface) {
test.test4() test.test4()