mirror of
https://github.com/isar/rusqlite.git
synced 2025-01-20 01:00:52 +08:00
Merge pull request #1314 from kornelski/track_caller
Use track_caller for panicking methods
This commit is contained in:
commit
d5eafd6613
@ -257,6 +257,7 @@ impl<'stmt> Row<'stmt> {
|
|||||||
/// * If the underlying SQLite integral value is outside the range
|
/// * If the underlying SQLite integral value is outside the range
|
||||||
/// representable by `T`
|
/// representable by `T`
|
||||||
/// * If `idx` is outside the range of columns in the returned query
|
/// * If `idx` is outside the range of columns in the returned query
|
||||||
|
#[track_caller]
|
||||||
pub fn get_unwrap<I: RowIndex, T: FromSql>(&self, idx: I) -> T {
|
pub fn get_unwrap<I: RowIndex, T: FromSql>(&self, idx: I) -> T {
|
||||||
self.get(idx).unwrap()
|
self.get(idx).unwrap()
|
||||||
}
|
}
|
||||||
@ -277,6 +278,7 @@ impl<'stmt> Row<'stmt> {
|
|||||||
/// If the result type is i128 (which requires the `i128_blob` feature to be
|
/// If the result type is i128 (which requires the `i128_blob` feature to be
|
||||||
/// enabled), and the underlying SQLite column is a blob whose size is not
|
/// enabled), and the underlying SQLite column is a blob whose size is not
|
||||||
/// 16 bytes, `Error::InvalidColumnType` will also be returned.
|
/// 16 bytes, `Error::InvalidColumnType` will also be returned.
|
||||||
|
#[track_caller]
|
||||||
pub fn get<I: RowIndex, T: FromSql>(&self, idx: I) -> Result<T> {
|
pub fn get<I: RowIndex, T: FromSql>(&self, idx: I) -> Result<T> {
|
||||||
let idx = idx.idx(self.stmt)?;
|
let idx = idx.idx(self.stmt)?;
|
||||||
let value = self.stmt.value_ref(idx);
|
let value = self.stmt.value_ref(idx);
|
||||||
@ -335,6 +337,7 @@ impl<'stmt> Row<'stmt> {
|
|||||||
///
|
///
|
||||||
/// * If `idx` is outside the range of columns in the returned query.
|
/// * If `idx` is outside the range of columns in the returned query.
|
||||||
/// * If `idx` is not a valid column name for this row.
|
/// * If `idx` is not a valid column name for this row.
|
||||||
|
#[track_caller]
|
||||||
pub fn get_ref_unwrap<I: RowIndex>(&self, idx: I) -> ValueRef<'_> {
|
pub fn get_ref_unwrap<I: RowIndex>(&self, idx: I) -> ValueRef<'_> {
|
||||||
self.get_ref(idx).unwrap()
|
self.get_ref(idx).unwrap()
|
||||||
}
|
}
|
||||||
|
@ -158,6 +158,7 @@ impl<'a> ValueRef<'a> {
|
|||||||
|
|
||||||
impl From<ValueRef<'_>> for Value {
|
impl From<ValueRef<'_>> for Value {
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[track_caller]
|
||||||
fn from(borrowed: ValueRef<'_>) -> Value {
|
fn from(borrowed: ValueRef<'_>) -> Value {
|
||||||
match borrowed {
|
match borrowed {
|
||||||
ValueRef::Null => Value::Null,
|
ValueRef::Null => Value::Null,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user