silence lints
This commit is contained in:
parent
a54d704300
commit
e0150a2161
1 changed files with 9 additions and 5 deletions
14
src/lib.rs
14
src/lib.rs
|
@ -20,6 +20,10 @@ pub use julid::Julid;
|
||||||
/// This `unsafe extern "C"` function is the main entry point into the loadable
|
/// This `unsafe extern "C"` function is the main entry point into the loadable
|
||||||
/// SQLite extension. By default, it and the `plugin` module it depends on will
|
/// SQLite extension. By default, it and the `plugin` module it depends on will
|
||||||
/// not be built. Build with `cargo build --features plugin`
|
/// not be built. Build with `cargo build --features plugin`
|
||||||
|
///
|
||||||
|
/// # Safety
|
||||||
|
/// This is FFI; it's inherently unsafe. But this function is called by
|
||||||
|
/// sqlite, not by a user, so it should be OK.
|
||||||
#[cfg(feature = "plugin")]
|
#[cfg(feature = "plugin")]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn sqlite3_julid_init(
|
pub unsafe extern "C" fn sqlite3_julid_init(
|
||||||
|
@ -40,7 +44,7 @@ pub unsafe extern "C" fn sqlite3_julid_init(
|
||||||
pub mod sqlite_plugin {
|
pub mod sqlite_plugin {
|
||||||
use sqlite_loadable::{
|
use sqlite_loadable::{
|
||||||
api, define_scalar_function,
|
api, define_scalar_function,
|
||||||
prelude::{sqlite3, sqlite3_context, sqlite3_value, FunctionFlags},
|
prelude::{sqlite3_context, sqlite3_value, FunctionFlags},
|
||||||
Result,
|
Result,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -92,7 +96,7 @@ pub mod sqlite_plugin {
|
||||||
/// 01HJSHZ0PN000EKP3H94R6TPWH
|
/// 01HJSHZ0PN000EKP3H94R6TPWH
|
||||||
/// ```
|
/// ```
|
||||||
pub fn julid_string(context: *mut sqlite3_context, id: &[*mut sqlite3_value]) -> Result<()> {
|
pub fn julid_string(context: *mut sqlite3_context, id: &[*mut sqlite3_value]) -> Result<()> {
|
||||||
if let Some(value) = id.get(0) {
|
if let Some(value) = id.first() {
|
||||||
let id = api::value_blob(value);
|
let id = api::value_blob(value);
|
||||||
let bytes: [u8; 16] = id.try_into().map_err(|_| {
|
let bytes: [u8; 16] = id.try_into().map_err(|_| {
|
||||||
sqlite_loadable::Error::new_message("Could not convert given value to Julid")
|
sqlite_loadable::Error::new_message("Could not convert given value to Julid")
|
||||||
|
@ -116,7 +120,7 @@ pub mod sqlite_plugin {
|
||||||
/// 2023-07-27 17:47:50
|
/// 2023-07-27 17:47:50
|
||||||
/// ```
|
/// ```
|
||||||
pub fn julid_seconds(context: *mut sqlite3_context, id: &[*mut sqlite3_value]) -> Result<()> {
|
pub fn julid_seconds(context: *mut sqlite3_context, id: &[*mut sqlite3_value]) -> Result<()> {
|
||||||
if let Some(value) = id.get(0) {
|
if let Some(value) = id.first() {
|
||||||
let id = api::value_blob(value);
|
let id = api::value_blob(value);
|
||||||
let bytes: [u8; 16] = id.try_into().map_err(|_| {
|
let bytes: [u8; 16] = id.try_into().map_err(|_| {
|
||||||
sqlite_loadable::Error::new_message("Could not convert given value to Julid")
|
sqlite_loadable::Error::new_message("Could not convert given value to Julid")
|
||||||
|
@ -143,7 +147,7 @@ pub mod sqlite_plugin {
|
||||||
/// 0
|
/// 0
|
||||||
/// ```
|
/// ```
|
||||||
pub fn julid_counter(context: *mut sqlite3_context, id: &[*mut sqlite3_value]) -> Result<()> {
|
pub fn julid_counter(context: *mut sqlite3_context, id: &[*mut sqlite3_value]) -> Result<()> {
|
||||||
if let Some(value) = id.get(0) {
|
if let Some(value) = id.first() {
|
||||||
let id = api::value_blob(value);
|
let id = api::value_blob(value);
|
||||||
let bytes: [u8; 16] = id.try_into().map_err(|_| {
|
let bytes: [u8; 16] = id.try_into().map_err(|_| {
|
||||||
sqlite_loadable::Error::new_message("Could not convert given value to Julid")
|
sqlite_loadable::Error::new_message("Could not convert given value to Julid")
|
||||||
|
@ -167,7 +171,7 @@ pub mod sqlite_plugin {
|
||||||
/// 110787724287475712
|
/// 110787724287475712
|
||||||
/// ```
|
/// ```
|
||||||
pub fn julid_sortable(context: *mut sqlite3_context, id: &[*mut sqlite3_value]) -> Result<()> {
|
pub fn julid_sortable(context: *mut sqlite3_context, id: &[*mut sqlite3_value]) -> Result<()> {
|
||||||
if let Some(value) = id.get(0) {
|
if let Some(value) = id.first() {
|
||||||
let id = api::value_blob(value);
|
let id = api::value_blob(value);
|
||||||
let bytes: [u8; 16] = id.try_into().map_err(|_| {
|
let bytes: [u8; 16] = id.try_into().map_err(|_| {
|
||||||
sqlite_loadable::Error::new_message("Could not convert given value to Julid")
|
sqlite_loadable::Error::new_message("Could not convert given value to Julid")
|
||||||
|
|
Loading…
Reference in a new issue