From 2890d154a331f7a26ea42d2077c825bbf1ad0980 Mon Sep 17 00:00:00 2001 From: Chloe Ross Date: Mon, 4 Jan 2021 16:58:11 -0800 Subject: [PATCH] doc: use the fancy new intra-crate doc links everywhere --- sqlx-core/src/any/migrate.rs | 2 +- sqlx-core/src/any/type.rs | 4 ++-- sqlx-core/src/any/types.rs | 2 +- sqlx-core/src/column.rs | 4 ++-- sqlx-core/src/connection.rs | 2 +- sqlx-core/src/database.rs | 18 +++++------------- sqlx-core/src/decode.rs | 6 +++--- sqlx-core/src/describe.rs | 2 +- sqlx-core/src/encode.rs | 2 +- sqlx-core/src/error.rs | 8 ++------ sqlx-core/src/from_row.rs | 4 +--- sqlx-core/src/mysql/options/mod.rs | 2 -- sqlx-core/src/mysql/options/ssl_mode.rs | 2 +- sqlx-core/src/mysql/protocol/handshake.rs | 0 sqlx-core/src/mysql/protocol/type.rs | 1 - sqlx-core/src/mysql/types/mod.rs | 2 +- sqlx-core/src/pool/mod.rs | 5 ++--- sqlx-core/src/pool/options.rs | 8 +++----- sqlx-core/src/postgres/listener.rs | 7 ++----- sqlx-core/src/postgres/options/mod.rs | 4 +--- sqlx-core/src/postgres/options/ssl_mode.rs | 2 +- sqlx-core/src/postgres/type_info.rs | 2 +- sqlx-core/src/postgres/types/bigdecimal.rs | 2 +- sqlx-core/src/postgres/types/decimal.rs | 2 +- sqlx-core/src/postgres/types/mod.rs | 13 +++---------- sqlx-core/src/postgres/types/money.rs | 4 +--- sqlx-core/src/query.rs | 6 +++--- sqlx-core/src/query_as.rs | 2 +- sqlx-core/src/row.rs | 10 +++++----- sqlx-core/src/sqlite/types/mod.rs | 2 +- sqlx-core/src/statement.rs | 2 +- sqlx-core/src/types/mod.rs | 15 ++++++--------- sqlx-core/src/value.rs | 8 ++++---- src/lib.rs | 14 +++++++------- 34 files changed, 66 insertions(+), 103 deletions(-) delete mode 100644 sqlx-core/src/mysql/protocol/handshake.rs delete mode 100644 sqlx-core/src/mysql/protocol/type.rs diff --git a/sqlx-core/src/any/migrate.rs b/sqlx-core/src/any/migrate.rs index d5d7df5b..8af3e6f0 100644 --- a/sqlx-core/src/any/migrate.rs +++ b/sqlx-core/src/any/migrate.rs @@ -187,7 +187,7 @@ impl Migrate for AnyConnection { AnyConnectionKind::MySql(conn) => conn.revert(migration), #[cfg(feature = "mssql")] - AnyConnectionKind::Mssql(conn) => unimplemented!(), + AnyConnectionKind::Mssql(_conn) => unimplemented!(), } } } diff --git a/sqlx-core/src/any/type.rs b/sqlx-core/src/any/type.rs index fc45e322..4a9a3aa9 100644 --- a/sqlx-core/src/any/type.rs +++ b/sqlx-core/src/any/type.rs @@ -12,12 +12,12 @@ use crate::mssql::Mssql; #[cfg(feature = "sqlite")] use crate::sqlite::Sqlite; -// Type is required by the bounds of the [Row] and [Arguments] trait but its been overridden in +// Type is required by the bounds of the [`Row`] and [`Arguments`] trait but its been overridden in // AnyRow and AnyArguments to not use this implementation; but instead, delegate to the // database-specific implementation. // // The other use of this trait is for compile-time verification which is not feasible to support -// for the [Any] driver. +// for the [`Any`] driver. macro_rules! impl_any_type { ($ty:ty) => { impl crate::types::Type for $ty diff --git a/sqlx-core/src/any/types.rs b/sqlx-core/src/any/types.rs index acdb8eb6..26eeb889 100644 --- a/sqlx-core/src/any/types.rs +++ b/sqlx-core/src/any/types.rs @@ -9,7 +9,7 @@ //! | `i64` | BIGINT | //! | `f32` | FLOAT | //! | `f64` | DOUBLE | -//! | `&str`, `String` | VARCHAR, CHAR, TEXT | +//! | `&str`, [`String`] | VARCHAR, CHAR, TEXT | //! //! # Nullable //! diff --git a/sqlx-core/src/column.rs b/sqlx-core/src/column.rs index 80bd0f43..e670e3b4 100644 --- a/sqlx-core/src/column.rs +++ b/sqlx-core/src/column.rs @@ -43,8 +43,8 @@ pub trait ColumnIndex: private_column_index::Sealed + Debug { /// Returns a valid positional index into the row or statement, [`ColumnIndexOutOfBounds`], or, /// [`ColumnNotFound`]. /// - /// [`ColumnNotFound`]: ../enum.Error.html#variant.ColumnNotFound - /// [`ColumnIndexOutOfBounds`]: ../enum.Error.html#variant.ColumnIndexOutOfBounds + /// [`ColumnNotFound`]: Error::ColumnNotFound + /// [`ColumnIndexOutOfBounds`]: Error::ColumnIndexOutOfBounds fn index(&self, container: &T) -> Result; } diff --git a/sqlx-core/src/connection.rs b/sqlx-core/src/connection.rs index c709dfec..5313c6c7 100644 --- a/sqlx-core/src/connection.rs +++ b/sqlx-core/src/connection.rs @@ -104,7 +104,7 @@ pub trait Connection: Send { /// Establish a new database connection. /// - /// A value of `Options` is parsed from the provided connection string. This parsing + /// A value of [`Options`][Self::Options] is parsed from the provided connection string. This parsing /// is database-specific. #[inline] fn connect(url: &str) -> BoxFuture<'static, Result> diff --git a/sqlx-core/src/database.rs b/sqlx-core/src/database.rs index 0aa22421..87089832 100644 --- a/sqlx-core/src/database.rs +++ b/sqlx-core/src/database.rs @@ -21,10 +21,10 @@ //! [PostgreSQL]: https://www.postgresql.org/ //! [SQLite]: https://www.sqlite.org/ //! -//! [`mysql`]: ../sqlite/index.html -//! [`postgres`]: ../postgres/index.html -//! [`mssql`]: ../mssql/index.html -//! [`sqlite`]: ../sqlite/index.html +//! [`mysql`]: crate::mysql +//! [`postgres`]: crate::postgres +//! [`mssql`]: crate::mssql +//! [`sqlite`]: crate::sqlite //! //! ## Tier 2 //! @@ -40,7 +40,7 @@ //! to take full advantage of the performance and type safety made available by Rust. //! //! We recognize that you may wish to make a runtime decision to decide the database driver. The -//! [`Any`] driver is provided for that purpose. +//! [`Any`](crate::any) driver is provided for that purpose. //! //! ## Example //! @@ -52,9 +52,6 @@ //! // required, decided by the scheme of the URI //! let conn = AnyConnection::connect("postgres://localhost/sqlx").await?; //! ``` -//! -//! [`Any`]: ../any/index.html -//! use std::fmt::Debug; @@ -111,7 +108,6 @@ pub trait Database: /// The upcoming Rust feature, [Generic Associated Types], should obviate /// the need for this trait. /// -/// [`Database`]: trait.Database.html /// [Generic Associated Types]: https://github.com/rust-lang/rust/issues/44265 pub trait HasValueRef<'r> { type Database: Database; @@ -128,7 +124,6 @@ pub trait HasValueRef<'r> { /// The upcoming Rust feature, [Generic Associated Types], should obviate /// the need for this trait. /// -/// [`Database`]: trait.Database.html /// [Generic Associated Types]: https://github.com/rust-lang/rust/issues/44265 pub trait HasArguments<'q> { type Database: Database; @@ -147,7 +142,6 @@ pub trait HasArguments<'q> { /// The upcoming Rust feature, [Generic Associated Types], should obviate /// the need for this trait. /// -/// [`Database`]: trait.Database.html /// [Generic Associated Types]: https://github.com/rust-lang/rust/issues/44265 pub trait HasStatement<'q> { type Database: Database; @@ -157,6 +151,4 @@ pub trait HasStatement<'q> { } /// A [`Database`] that maintains a client-side cache of prepared statements. -/// -/// [`Database`]: trait.Database.html pub trait HasStatementCache {} diff --git a/sqlx-core/src/decode.rs b/sqlx-core/src/decode.rs index 82e14d0d..40b85e0e 100644 --- a/sqlx-core/src/decode.rs +++ b/sqlx-core/src/decode.rs @@ -1,4 +1,4 @@ -//! Provides [`Decode`](trait.Decode.html) for decoding values from the database. +//! Provides [`Decode`] for decoding values from the database. use crate::database::{Database, HasValueRef}; use crate::error::BoxDynError; @@ -11,9 +11,9 @@ use crate::value::ValueRef; /// A manual implementation of `Decode` can be useful when adding support for /// types externally to SQLx. /// -/// The following showcases how to implement `Decode` to be generic over `Database`. The +/// The following showcases how to implement `Decode` to be generic over [`Database`]. The /// implementation can be marginally simpler if you remove the `DB` type parameter and explicitly -/// use the concrete `ValueRef` and `TypeInfo` types. +/// use the concrete [`ValueRef`](HasValueRef::ValueRef) and [`TypeInfo`](Database::TypeInfo) types. /// /// ```rust /// # use sqlx_core::database::{Database, HasValueRef}; diff --git a/sqlx-core/src/describe.rs b/sqlx-core/src/describe.rs index 11eefea1..91e6242b 100644 --- a/sqlx-core/src/describe.rs +++ b/sqlx-core/src/describe.rs @@ -4,7 +4,7 @@ use std::convert::identity; /// Provides extended information on a statement. /// -/// Returned from [`Executor::describe`](trait.Executor.html#method.describe). +/// Returned from [`Executor::describe`]. /// /// The query macros (e.g., `query!`, `query_as!`, etc.) use the information here to validate /// output and parameter types; and, generate an anonymous record. diff --git a/sqlx-core/src/encode.rs b/sqlx-core/src/encode.rs index ba439263..a734d0eb 100644 --- a/sqlx-core/src/encode.rs +++ b/sqlx-core/src/encode.rs @@ -1,4 +1,4 @@ -//! Provides [`Encode`](trait.Encode.html) for encoding values for the database. +//! Provides [`Encode`] for encoding values for the database. use std::mem; diff --git a/sqlx-core/src/error.rs b/sqlx-core/src/error.rs index 238681fa..bc20d606 100644 --- a/sqlx-core/src/error.rs +++ b/sqlx-core/src/error.rs @@ -20,7 +20,7 @@ pub type BoxDynError = Box; /// An unexpected `NULL` was encountered during decoding. /// -/// Returned from [`Row::get`](sqlx_core::row::Row::get) if the value from the database is `NULL`, +/// Returned from [`Row::get`](crate::row::Row::get) if the value from the database is `NULL`, /// and you are not decoding into an `Option`. #[derive(thiserror::Error, Debug)] #[error("unexpected null; try decoding as an `Option`")] @@ -92,9 +92,7 @@ pub enum Error { #[error("attempted to acquire a connection on a closed pool")] PoolClosed, - /// A background worker (e.g. [`StatementWorker`]) has crashed. - /// - /// [`StatementWorker`]: crate::sqlite::StatementWorker + /// A background worker has crashed. #[error("attempted to communicate with a crashed background worker")] WorkerCrashed, @@ -171,7 +169,6 @@ impl dyn DatabaseError { /// Panics if the database error type is not `E`. This is a deliberate contrast from /// `Error::downcast_ref` which returns `Option<&E>`. In normal usage, you should know the /// specific error type. In other cases, use `try_downcast_ref`. - /// pub fn downcast_ref(&self) -> &E { self.try_downcast_ref().unwrap_or_else(|| { panic!( @@ -188,7 +185,6 @@ impl dyn DatabaseError { /// Panics if the database error type is not `E`. This is a deliberate contrast from /// `Error::downcast` which returns `Option`. In normal usage, you should know the /// specific error type. In other cases, use `try_downcast`. - /// pub fn downcast(self: Box) -> Box { self.try_downcast().unwrap_or_else(|e| { panic!( diff --git a/sqlx-core/src/from_row.rs b/sqlx-core/src/from_row.rs index ef934ea3..6f05d008 100644 --- a/sqlx-core/src/from_row.rs +++ b/sqlx-core/src/from_row.rs @@ -3,7 +3,7 @@ use crate::row::Row; /// A record that can be built from a row returned by the database. /// -/// In order to use [`query_as`] the output type must implement `FromRow`. +/// In order to use [`query_as`](crate::query_as) the output type must implement `FromRow`. /// /// ## Derivable /// @@ -92,8 +92,6 @@ use crate::row::Row; /// will set the value of the field `location` to the default value of `Option`, /// which is `None`. /// -/// [`query_as`]: fn.query_as.html -/// [`Row::try_get`]: trait.Row.html#method.try_get pub trait FromRow<'r, R: Row>: Sized { fn from_row(row: &'r R) -> Result; } diff --git a/sqlx-core/src/mysql/options/mod.rs b/sqlx-core/src/mysql/options/mod.rs index ce107a13..5ee6ea62 100644 --- a/sqlx-core/src/mysql/options/mod.rs +++ b/sqlx-core/src/mysql/options/mod.rs @@ -51,8 +51,6 @@ pub use ssl_mode::MySqlSslMode; /// # }).unwrap(); /// # } /// ``` -/// -/// [`MySqlSslMode`]: enum.MySqlSslMode.html #[derive(Debug, Clone)] pub struct MySqlConnectOptions { pub(crate) host: String, diff --git a/sqlx-core/src/mysql/options/ssl_mode.rs b/sqlx-core/src/mysql/options/ssl_mode.rs index be51892f..a9abf084 100644 --- a/sqlx-core/src/mysql/options/ssl_mode.rs +++ b/sqlx-core/src/mysql/options/ssl_mode.rs @@ -3,7 +3,7 @@ use std::str::FromStr; /// Options for controlling the desired security state of the connection to the MySQL server. /// -/// It is used by the [`ssl_mode`](MySqlConnectOptions::ssl_mode) method. +/// It is used by the [`ssl_mode`](super::MySqlConnectOptions::ssl_mode) method. #[derive(Debug, Clone, Copy)] pub enum MySqlSslMode { /// Establish an unencrypted connection. diff --git a/sqlx-core/src/mysql/protocol/handshake.rs b/sqlx-core/src/mysql/protocol/handshake.rs deleted file mode 100644 index e69de29b..00000000 diff --git a/sqlx-core/src/mysql/protocol/type.rs b/sqlx-core/src/mysql/protocol/type.rs deleted file mode 100644 index 8b137891..00000000 --- a/sqlx-core/src/mysql/protocol/type.rs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/sqlx-core/src/mysql/types/mod.rs b/sqlx-core/src/mysql/types/mod.rs index fe701cb6..4f7854b5 100644 --- a/sqlx-core/src/mysql/types/mod.rs +++ b/sqlx-core/src/mysql/types/mod.rs @@ -15,7 +15,7 @@ //! | `u64` | BIGINT UNSIGNED | //! | `f32` | FLOAT | //! | `f64` | DOUBLE | -//! | `&str`, `String` | VARCHAR, CHAR, TEXT | +//! | `&str`, [`String`] | VARCHAR, CHAR, TEXT | //! | `&[u8]`, `Vec` | VARBINARY, BINARY, BLOB | //! //! ### [`chrono`](https://crates.io/crates/chrono) diff --git a/sqlx-core/src/pool/mod.rs b/sqlx-core/src/pool/mod.rs index faa9ad33..10b9c173 100644 --- a/sqlx-core/src/pool/mod.rs +++ b/sqlx-core/src/pool/mod.rs @@ -51,9 +51,8 @@ //! ``` //! //! A connection or transaction may also be manually acquired with -//! [`Pool::acquire`][Pool::acquire] or -//! [`Pool::begin`][Pool::begin]. -//! +//! [`Pool::acquire`] or +//! [`Pool::begin`]. use self::inner::SharedPool; use crate::connection::Connection; diff --git a/sqlx-core/src/pool/options.rs b/sqlx-core/src/pool/options.rs index c16d694f..d4d5db2f 100644 --- a/sqlx-core/src/pool/options.rs +++ b/sqlx-core/src/pool/options.rs @@ -77,8 +77,8 @@ impl PoolOptions { /// If any connection is reaped by [`max_lifetime`] or [`idle_timeout`] and it brings /// the connection count below this amount, a new connection will be opened to replace it. /// - /// [`max_lifetime`]: #method.max_lifetime - /// [`idle_timeout`]: #method.idle_timeout + /// [`max_lifetime`]: Self::max_lifetime + /// [`idle_timeout`]: Self::idle_timeout pub fn min_connections(mut self, min: u32) -> Self { self.min_connections = min; self @@ -97,7 +97,7 @@ impl PoolOptions { /// (parse trees, query metadata caches, thread-local storage, etc.) that are associated with a /// session. /// - /// [`idle_timeout`]: #method.idle_timeout + /// [`idle_timeout`]: Self::idle_timeout pub fn max_lifetime(mut self, lifetime: impl Into>) -> Self { self.max_lifetime = lifetime.into(); self @@ -117,8 +117,6 @@ impl PoolOptions { /// before returning the connection. /// /// Defaults to `true`. - /// - /// [`Connection::ping`]: crate::connection::Connection::ping pub fn test_before_acquire(mut self, test: bool) -> Self { self.test_before_acquire = test; self diff --git a/sqlx-core/src/postgres/listener.rs b/sqlx-core/src/postgres/listener.rs index ae80f4ac..ea62fde7 100644 --- a/sqlx-core/src/postgres/listener.rs +++ b/sqlx-core/src/postgres/listener.rs @@ -142,7 +142,7 @@ impl PgListener { /// /// As notifications are transient, any received while the connection was lost, will not /// be returned. If you'd prefer the reconnection to be explicit and have a chance to - /// do something before, please see [`try_recv`]. + /// do something before, please see [`try_recv`](Self::try_recv). /// /// # Example /// @@ -162,8 +162,6 @@ impl PgListener { /// # Ok(()) /// # }).unwrap(); /// ``` - /// - /// [`try_recv`]: #method.try_recv pub async fn recv(&mut self) -> Result { loop { if let Some(notification) = self.try_recv().await? { @@ -248,9 +246,8 @@ impl PgListener { /// /// The backing connection will be automatically reconnected should it be lost. /// - /// This has the same potential drawbacks as [`recv`]. + /// This has the same potential drawbacks as [`recv`](PgListener::recv). /// - /// [`recv`]: #method.recv pub fn into_stream(mut self) -> impl Stream> + Unpin { Box::pin(try_stream! { loop { diff --git a/sqlx-core/src/postgres/options/mod.rs b/sqlx-core/src/postgres/options/mod.rs index 490b59c7..9c667af3 100644 --- a/sqlx-core/src/postgres/options/mod.rs +++ b/sqlx-core/src/postgres/options/mod.rs @@ -22,7 +22,7 @@ pub use ssl_mode::PgSslMode; /// /// |Parameter|Default|Description| /// |---------|-------|-----------| -/// | `sslmode` | `prefer` | Determines whether or with what priority a secure SSL TCP/IP connection will be negotiated. See [`PgSqlSslMode`]. | +/// | `sslmode` | `prefer` | Determines whether or with what priority a secure SSL TCP/IP connection will be negotiated. See [`PgSslMode`]. | /// | `sslrootcert` | `None` | Sets the name of a file containing a list of trusted SSL Certificate Authorities. | /// | `statement-cache-capacity` | `100` | The maximum number of prepared statements stored in the cache. Set to `0` to disable. | /// | `host` | `None` | Path to the directory containing a PostgreSQL unix domain socket, which will be used instead of TCP if set. | @@ -71,8 +71,6 @@ pub use ssl_mode::PgSslMode; /// # }).unwrap(); /// # } /// ``` -/// -/// [`PgSqlSslMode`]: enum.PgSslMode.html #[derive(Debug, Clone)] pub struct PgConnectOptions { pub(crate) host: String, diff --git a/sqlx-core/src/postgres/options/ssl_mode.rs b/sqlx-core/src/postgres/options/ssl_mode.rs index fe2a9b61..936e862d 100644 --- a/sqlx-core/src/postgres/options/ssl_mode.rs +++ b/sqlx-core/src/postgres/options/ssl_mode.rs @@ -3,7 +3,7 @@ use std::str::FromStr; /// Options for controlling the level of protection provided for PostgreSQL SSL connections. /// -/// It is used by the [`ssl_mode`](PgConnectOptions::ssl_mode) method. +/// It is used by the [`ssl_mode`](super::PgConnectOptions::ssl_mode) method. #[derive(Debug, Clone, Copy)] pub enum PgSslMode { /// Only try a non-SSL connection. diff --git a/sqlx-core/src/postgres/type_info.rs b/sqlx-core/src/postgres/type_info.rs index a6621b6f..6f85364a 100644 --- a/sqlx-core/src/postgres/type_info.rs +++ b/sqlx-core/src/postgres/type_info.rs @@ -217,7 +217,7 @@ impl PgTypeInfo { /// /// Note that the OID for a type is very dependent on the environment. If you only ever use /// one database or if this is an unhandled build-in type, you should be fine. Otherwise, - /// you will be better served using [`with_name`](#method.with_name). + /// you will be better served using [`with_name`](Self::with_name). pub const fn with_oid(oid: u32) -> Self { Self(PgType::DeclareWithOid(oid)) } diff --git a/sqlx-core/src/postgres/types/bigdecimal.rs b/sqlx-core/src/postgres/types/bigdecimal.rs index 7a3c5b01..2a2479a7 100644 --- a/sqlx-core/src/postgres/types/bigdecimal.rs +++ b/sqlx-core/src/postgres/types/bigdecimal.rs @@ -146,7 +146,7 @@ impl TryFrom<&'_ BigDecimal> for PgNumeric { } /// ### Panics -/// If this `BigDecimal` cannot be represented by [PgNumeric]. +/// If this `BigDecimal` cannot be represented by `PgNumeric`. impl Encode<'_, Postgres> for BigDecimal { fn encode_by_ref(&self, buf: &mut PgArgumentBuffer) -> IsNull { PgNumeric::try_from(self) diff --git a/sqlx-core/src/postgres/types/decimal.rs b/sqlx-core/src/postgres/types/decimal.rs index 4c9489a8..e206b86b 100644 --- a/sqlx-core/src/postgres/types/decimal.rs +++ b/sqlx-core/src/postgres/types/decimal.rs @@ -155,7 +155,7 @@ impl TryFrom<&'_ Decimal> for PgNumeric { } /// ### Panics -/// If this `Decimal` cannot be represented by [PgNumeric]. +/// If this `Decimal` cannot be represented by `PgNumeric`. impl Encode<'_, Postgres> for Decimal { fn encode_by_ref(&self, buf: &mut PgArgumentBuffer) -> IsNull { PgNumeric::try_from(self) diff --git a/sqlx-core/src/postgres/types/mod.rs b/sqlx-core/src/postgres/types/mod.rs index dff2ba2d..e285415d 100644 --- a/sqlx-core/src/postgres/types/mod.rs +++ b/sqlx-core/src/postgres/types/mod.rs @@ -11,15 +11,12 @@ //! | `i64` | BIGINT, BIGSERIAL, INT8 | //! | `f32` | REAL, FLOAT4 | //! | `f64` | DOUBLE PRECISION, FLOAT8 | -//! | `&str`, `String` | VARCHAR, CHAR(N), TEXT, NAME | +//! | `&str`, [`String`] | VARCHAR, CHAR(N), TEXT, NAME | //! | `&[u8]`, `Vec` | BYTEA | //! | [`PgInterval`] | INTERVAL | -//! | [`PgRange`] | INT8RANGE, INT4RANGE, TSRANGE, TSTZTRANGE, DATERANGE, NUMRANGE | +//! | [`PgRange`](PgRange) | INT8RANGE, INT4RANGE, TSRANGE, TSTZTRANGE, DATERANGE, NUMRANGE | //! | [`PgMoney`] | MONEY | //! -//! [`PgInterval`]: struct.PgInterval.html -//! [`PgRange`]: struct.PgRange.html -//! [`PgMoney`]: struct.PgMoney.html //! //! ### [`bigdecimal`](https://crates.io/crates/bigdecimal) //! Requires the `bigdecimal` Cargo feature flag. @@ -60,8 +57,6 @@ //! | `time::Time` | TIME | //! | [`PgTimeTz`] | TIMETZ | //! -//! [`PgTimeTz`]: struct.PgTimeTz.html -//! //! ### [`uuid`](https://crates.io/crates/uuid) //! //! Requires the `uuid` Cargo feature flag. @@ -99,9 +94,7 @@ //! `Value` and `RawValue` from `serde_json` can be used for unstructured JSON data with //! Postgres. //! -//! [`Json`] can be used for structured JSON data with Postgres. -//! -//! [`Json`]: crate::types::Json +//! [`Json`](crate::types::Json) can be used for structured JSON data with Postgres. //! //! # [Composite types](https://www.postgresql.org/docs/current/rowtypes.html) //! diff --git a/sqlx-core/src/postgres/types/money.rs b/sqlx-core/src/postgres/types/money.rs index 6b1d6845..2ae47dcd 100644 --- a/sqlx-core/src/postgres/types/money.rs +++ b/sqlx-core/src/postgres/types/money.rs @@ -62,10 +62,8 @@ impl PgMoney { Self(i64::from_le_bytes(buf)) } - /// Convert a [`BigDecimal`] value into money using the correct precision + /// Convert a [`BigDecimal`](crate::types::BigDecimal) value into money using the correct precision /// defined in the PostgreSQL settings. The default precision is two. - /// - /// [`BigDecimal`]: ../../types/struct.BigDecimal.html #[cfg(feature = "bigdecimal")] pub fn from_bigdecimal( decimal: bigdecimal::BigDecimal, diff --git a/sqlx-core/src/query.rs b/sqlx-core/src/query.rs index 6c188aaa..dbfe2ea7 100644 --- a/sqlx-core/src/query.rs +++ b/sqlx-core/src/query.rs @@ -23,11 +23,11 @@ pub struct Query<'q, DB: Database, A> { /// SQL query that will map its results to owned Rust types. /// -/// Returned by [Query::try_map], `query!()`, etc. Has most of the same methods as [Query] but +/// Returned by [`Query::try_map`], `query!()`, etc. Has most of the same methods as [`Query`] but /// the return types are changed to reflect the mapping. However, there is no equivalent of -/// [Query::execute] as it doesn't make sense to map the result type and then ignore it. +/// [`Query::execute`] as it doesn't make sense to map the result type and then ignore it. /// -/// [Query::bind] is also omitted; stylistically we recommend placing your `.bind()` calls +/// [`Query::bind`] is also omitted; stylistically we recommend placing your `.bind()` calls /// before `.try_map()`. This is also to prevent adding superfluous binds to the result of /// `query!()` et al. #[must_use = "query must be executed to affect database"] diff --git a/sqlx-core/src/query_as.rs b/sqlx-core/src/query_as.rs index ba0441e8..efc8b800 100644 --- a/sqlx-core/src/query_as.rs +++ b/sqlx-core/src/query_as.rs @@ -50,7 +50,7 @@ where impl<'q, DB: Database, O> QueryAs<'q, DB, O, >::Arguments> { /// Bind a value for use with this SQL query. /// - /// See [`Query::bind`](crate::query::Query::bind). + /// See [`Query::bind`](Query::bind). pub fn bind + Type>(mut self, value: T) -> Self { self.inner = self.inner.bind(value); self diff --git a/sqlx-core/src/row.rs b/sqlx-core/src/row.rs index 99c86af0..9376d13c 100644 --- a/sqlx-core/src/row.rs +++ b/sqlx-core/src/row.rs @@ -35,7 +35,7 @@ pub trait Row: private_row::Sealed + Unpin + Send + Sync + 'static { /// # Panics /// /// Panics if `index` is out of bounds. - /// See [`try_column`](#method.try_column) for a non-panicking version. + /// See [`try_column`](Self::try_column) for a non-panicking version. fn column(&self, index: I) -> &::Column where I: ColumnIndex, @@ -62,7 +62,7 @@ pub trait Row: private_row::Sealed + Unpin + Send + Sync + 'static { /// # Panics /// /// Panics if the column does not exist or its value cannot be decoded into the requested type. - /// See [`try_get`](#method.try_get) for a non-panicking version. + /// See [`try_get`](Self::try_get) for a non-panicking version. /// #[inline] fn get<'r, T, I>(&'r self, index: I) -> T @@ -75,14 +75,14 @@ pub trait Row: private_row::Sealed + Unpin + Send + Sync + 'static { /// Index into the database row and decode a single value. /// - /// Unlike [`get`](#method.get), this method does not check that the type + /// Unlike [`get`](Self::get), this method does not check that the type /// being returned from the database is compatible with the Rust type and blindly tries /// to decode the value. /// /// # Panics /// /// Panics if the column does not exist or its value cannot be decoded into the requested type. - /// See [`try_get_unchecked`](#method.try_get_unchecked) for a non-panicking version. + /// See [`try_get_unchecked`](Self::try_get_unchecked) for a non-panicking version. /// #[inline] fn get_unchecked<'r, T, I>(&'r self, index: I) -> T @@ -134,7 +134,7 @@ pub trait Row: private_row::Sealed + Unpin + Send + Sync + 'static { /// Index into the database row and decode a single value. /// - /// Unlike [`try_get`](#method.try_get), this method does not check that the type + /// Unlike [`try_get`](Self::try_get), this method does not check that the type /// being returned from the database is compatible with the Rust type and blindly tries /// to decode the value. /// diff --git a/sqlx-core/src/sqlite/types/mod.rs b/sqlx-core/src/sqlite/types/mod.rs index e2d3e5f4..cafae484 100644 --- a/sqlx-core/src/sqlite/types/mod.rs +++ b/sqlx-core/src/sqlite/types/mod.rs @@ -10,7 +10,7 @@ //! | `i64` | BIGINT, INT8 | //! | `f32` | REAL | //! | `f64` | REAL | -//! | `&str`, `String` | TEXT | +//! | `&str`, [`String`] | TEXT | //! | `&[u8]`, `Vec` | BLOB | //! //! ### [`chrono`](https://crates.io/crates/chrono) diff --git a/sqlx-core/src/statement.rs b/sqlx-core/src/statement.rs index bcd38032..1260fa46 100644 --- a/sqlx-core/src/statement.rs +++ b/sqlx-core/src/statement.rs @@ -43,7 +43,7 @@ pub trait Statement<'q>: Send + Sync { /// # Panics /// /// Panics if `index` is out of bounds. - /// See [`try_column`](#method.try_column) for a non-panicking version. + /// See [`try_column`](Self::try_column) for a non-panicking version. fn column(&self, index: I) -> &::Column where I: ColumnIndex, diff --git a/sqlx-core/src/types/mod.rs b/sqlx-core/src/types/mod.rs index cf1e3563..cbeb0246 100644 --- a/sqlx-core/src/types/mod.rs +++ b/sqlx-core/src/types/mod.rs @@ -3,10 +3,10 @@ //! To see how each SQL type maps to a Rust type, see the corresponding `types` module for each //! database: //! -//! * [PostgreSQL](../postgres/types/index.html) -//! * [MySQL](../mysql/types/index.html) -//! * [SQLite](../sqlite/types/index.html) -//! * [MSSQL](../mssql/types/index.html) +//! * [PostgreSQL](crate::postgres::types) +//! * [MySQL](crate::mysql::types) +//! * [SQLite](crate::sqlite::types) +//! * [MSSQL](crate::mssql::types) //! //! Any external types that have had [`Type`] implemented for, are re-exported in this module //! for convenience as downstream users need to use a compatible version of the external crate @@ -14,7 +14,7 @@ //! //! # Nullable //! -//! To represents nullable SQL types, `Option` is supported where `T` implements `Type`. +//! To represent nullable SQL types, `Option` is supported where `T` implements `Type`. //! An `Option` represents a potentially `NULL` value from SQL. //! @@ -89,12 +89,9 @@ pub use json::Json; /// ## Derivable /// /// This trait can be derived by SQLx to support Rust-only wrapper types, enumerations, and (for -/// postgres) structured records. Additionally, an implementation of [`Encode`] and [`Decode`] is +/// postgres) structured records. Additionally, an implementation of [`Encode`](crate::encode::Encode) and [`Decode`](crate::decode::Decode) is /// generated. /// -/// [`Encode`]: trait.Encode.html -/// [`Decode`]: trait.Decode.html -/// /// ### Transparent /// /// Rust-only domain or wrappers around SQL types. The generated implementations directly delegate diff --git a/sqlx-core/src/value.rs b/sqlx-core/src/value.rs index 88558610..0176e8d1 100644 --- a/sqlx-core/src/value.rs +++ b/sqlx-core/src/value.rs @@ -23,7 +23,7 @@ pub trait Value { /// # Panics /// /// Panics if the value cannot be decoded into the requested type. - /// See [`try_decode`](#method.try_decode) for a non-panicking version. + /// See [`try_decode`](Self::try_decode) for a non-panicking version. /// #[inline] fn decode<'r, T>(&'r self) -> T @@ -35,13 +35,13 @@ pub trait Value { /// Decode this single value into the requested type. /// - /// Unlike [`decode`](#method.decode), this method does not check that the type of this + /// Unlike [`decode`](Self::decode), this method does not check that the type of this /// value is compatible with the Rust type and blindly tries to decode the value. /// /// # Panics /// /// Panics if the value cannot be decoded into the requested type. - /// See [`try_decode_unchecked`](#method.try_decode_unchecked) for a non-panicking version. + /// See [`try_decode_unchecked`](Self::try_decode_unchecked) for a non-panicking version. /// #[inline] fn decode_unchecked<'r, T>(&'r self) -> T @@ -77,7 +77,7 @@ pub trait Value { /// Decode this single value into the requested type. /// - /// Unlike [`try_decode`](#method.try_decode), this method does not check that the type of this + /// Unlike [`try_decode`](Self::try_decode), this method does not check that the type of this /// value is compatible with the Rust type and blindly tries to decode the value. /// /// # Errors diff --git a/src/lib.rs b/src/lib.rs index e2a404b0..30ded66a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -87,16 +87,16 @@ pub mod ty_match; /// To see how each SQL type maps to a Rust type, see the corresponding `types` module for each /// database: /// -/// * [PostgreSQL](../postgres/types/index.html) -/// * [MySQL](../mysql/types/index.html) -/// * [SQLite](../sqlite/types/index.html) -/// * [MSSQL](../mssql/types/index.html) +/// * Postgres: [postgres::types] +/// * MySQL: [mysql::types] +/// * SQLite: [sqlite::types] +/// * MSSQL: [mssql::types] /// /// Any external types that have had [`Type`] implemented for, are re-exported in this module /// for convenience as downstream users need to use a compatible version of the external crate /// to take advantage of the implementation. /// -/// [`Type`]: types/trait.Type.html +/// [`Type`]: types::Type pub mod types { pub use sqlx_core::types::*; @@ -105,7 +105,7 @@ pub mod types { pub use sqlx_macros::Type; } -/// Provides [`Encode`](encode/trait.Encode.html) for encoding values for the database. +/// Provides [`Encode`](encode::Encode) for encoding values for the database. pub mod encode { pub use sqlx_core::encode::{Encode, IsNull}; @@ -116,7 +116,7 @@ pub mod encode { pub use self::encode::Encode; -/// Provides [`Decode`](decode/trait.Decode.html) for decoding values from the database. +/// Provides [`Decode`](decode::Decode) for decoding values from the database. pub mod decode { pub use sqlx_core::decode::Decode;