Add/fix rustdoc links

This commit is contained in:
gwenn
2020-11-22 09:34:03 +01:00
parent 7beba0c6eb
commit 6fae5d6641
20 changed files with 90 additions and 90 deletions

View File

@@ -3,7 +3,7 @@ use std::convert::TryInto;
use std::error::Error;
use std::fmt;
/// Enum listing possible errors from `FromSql` trait.
/// Enum listing possible errors from [`FromSql`] trait.
#[derive(Debug)]
#[non_exhaustive]
pub enum FromSqlError {
@@ -26,7 +26,7 @@ pub enum FromSqlError {
#[cfg(feature = "uuid")]
InvalidUuidSize(usize),
/// An error case available for implementors of the `FromSql` trait.
/// An error case available for implementors of the [`FromSql`] trait.
Other(Box<dyn Error + Send + Sync + 'static>),
}
@@ -72,7 +72,7 @@ impl Error for FromSqlError {
}
}
/// Result type for implementors of the `FromSql` trait.
/// Result type for implementors of the [`FromSql`] trait.
pub type FromSqlResult<T> = Result<T, FromSqlError>;
/// A trait for types that can be created from a SQLite value.

View File

@@ -1,7 +1,7 @@
//! Traits dealing with SQLite data types.
//!
//! SQLite uses a [dynamic type system](https://www.sqlite.org/datatype3.html). Implementations of
//! the `ToSql` and `FromSql` traits are provided for the basic types that
//! the [`ToSql`] and [`FromSql`] traits are provided for the basic types that
//! SQLite provides methods for:
//!
//! * Strings (`String` and `&str`)
@@ -11,17 +11,17 @@
//! The number situation is a little complicated due to the fact that all
//! numbers in SQLite are stored as `INTEGER` (`i64`) or `REAL` (`f64`).
//!
//! `ToSql` and `FromSql` are implemented for all primitive number types.
//! `FromSql` has different behaviour depending on the SQL and Rust types, and
//! [`ToSql`] and [`FromSql`] are implemented for all primitive number types.
//! [`FromSql`] has different behaviour depending on the SQL and Rust types, and
//! the value.
//!
//! * `INTEGER` to integer: returns an `Error::IntegralValueOutOfRange` error if
//! * `INTEGER` to integer: returns an [`Error::IntegralValueOutOfRange`](crate::Error::IntegralValueOutOfRange) error if
//! the value does not fit in the Rust type.
//! * `REAL` to integer: always returns an `Error::InvalidColumnType` error.
//! * `REAL` to integer: always returns an [`Error::InvalidColumnType`](crate::Error::InvalidColumnType) error.
//! * `INTEGER` to float: casts using `as` operator. Never fails.
//! * `REAL` to float: casts using `as` operator. Never fails.
//!
//! `ToSql` always succeeds except when storing a `u64` or `usize` value that
//! [`ToSql`] always succeeds except when storing a `u64` or `usize` value that
//! cannot fit in an `INTEGER` (`i64`). Also note that SQLite ignores column
//! types, so if you store an `i64` in a column with type `REAL` it will be
//! stored as an `INTEGER`, not a `REAL`.
@@ -61,8 +61,8 @@ impl ToSql for DateTimeSql {
"##
)]
//! `ToSql` and `FromSql` are also implemented for `Option<T>` where `T`
//! implements `ToSql` or `FromSql` for the cases where you want to know if a
//! [`ToSql`] and [`FromSql`] are also implemented for `Option<T>` where `T`
//! implements [`ToSql`] or [`FromSql`] for the cases where you want to know if a
//! value was NULL (which gets translated to `None`).
pub use self::from_sql::{FromSql, FromSqlError, FromSqlResult};

View File

@@ -1,4 +1,4 @@
//! `ToSql` and `FromSql` implementation for JSON `Value`.
//! [`ToSql`] and [`FromSql`] implementation for JSON `Value`.
use serde_json::Value;

View File

@@ -1,4 +1,4 @@
//! `ToSql` and `FromSql` implementation for [`time::OffsetDateTime`].
//! [`ToSql`] and [`FromSql`] implementation for [`time::OffsetDateTime`].
use crate::types::{FromSql, FromSqlError, FromSqlResult, ToSql, ToSqlOutput, ValueRef};
use crate::Result;
use time::{OffsetDateTime, PrimitiveDateTime, UtcOffset};

View File

@@ -6,7 +6,7 @@ use std::borrow::Cow;
use std::convert::TryFrom;
/// `ToSqlOutput` represents the possible output types for implementers of the
/// `ToSql` trait.
/// [`ToSql`] trait.
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ToSqlOutput<'a> {
@@ -91,7 +91,7 @@ impl ToSql for ToSqlOutput<'_> {
}
/// A trait for types that can be converted into SQLite values. Returns
/// `Error::ToSqlConversionFailure` if the conversion fails.
/// [`Error::ToSqlConversionFailure`] if the conversion fails.
pub trait ToSql {
/// Converts Rust value to SQLite value
fn to_sql(&self) -> Result<ToSqlOutput<'_>>;

View File

@@ -1,4 +1,4 @@
//! `ToSql` and `FromSql` implementation for [`url::Url`].
//! [`ToSql`] and [`FromSql`] implementation for [`url::Url`].
use crate::types::{FromSql, FromSqlError, FromSqlResult, ToSql, ToSqlOutput, ValueRef};
use crate::Result;
use url::Url;

View File

@@ -3,7 +3,7 @@ use super::{Null, Type};
/// Owning [dynamic type value](http://sqlite.org/datatype3.html). Value's type is typically
/// dictated by SQLite (not by the caller).
///
/// See [`ValueRef`](enum.ValueRef.html) for a non-owning dynamic type value.
/// See [`ValueRef`](crate::types::ValueRef) for a non-owning dynamic type value.
#[derive(Clone, Debug, PartialEq)]
pub enum Value {
/// The value is a `NULL` value.

View File

@@ -4,7 +4,7 @@ use crate::types::{FromSqlError, FromSqlResult};
/// A non-owning [dynamic type value](http://sqlite.org/datatype3.html). Typically the
/// memory backing this value is owned by SQLite.
///
/// See [`Value`](enum.Value.html) for an owning dynamic type value.
/// See [`Value`](Value) for an owning dynamic type value.
#[derive(Copy, Clone, Debug, PartialEq)]
pub enum ValueRef<'a> {
/// The value is a `NULL` value.
@@ -35,7 +35,7 @@ impl ValueRef<'_> {
impl<'a> ValueRef<'a> {
/// If `self` is case `Integer`, returns the integral value. Otherwise,
/// returns `Err(Error::InvalidColumnType)`.
/// returns [`Err(Error::InvalidColumnType)`](crate::Error::InvalidColumnType).
#[inline]
pub fn as_i64(&self) -> FromSqlResult<i64> {
match *self {
@@ -45,7 +45,7 @@ impl<'a> ValueRef<'a> {
}
/// If `self` is case `Real`, returns the floating point value. Otherwise,
/// returns `Err(Error::InvalidColumnType)`.
/// returns [`Err(Error::InvalidColumnType)`](crate::Error::InvalidColumnType).
#[inline]
pub fn as_f64(&self) -> FromSqlResult<f64> {
match *self {
@@ -55,7 +55,7 @@ impl<'a> ValueRef<'a> {
}
/// If `self` is case `Text`, returns the string value. Otherwise, returns
/// `Err(Error::InvalidColumnType)`.
/// [`Err(Error::InvalidColumnType)`](crate::Error::InvalidColumnType).
#[inline]
pub fn as_str(&self) -> FromSqlResult<&'a str> {
match *self {
@@ -67,7 +67,7 @@ impl<'a> ValueRef<'a> {
}
/// If `self` is case `Blob`, returns the byte slice. Otherwise, returns
/// `Err(Error::InvalidColumnType)`.
/// [`Err(Error::InvalidColumnType)`](crate::Error::InvalidColumnType).
#[inline]
pub fn as_blob(&self) -> FromSqlResult<&'a [u8]> {
match *self {