Skip to content

Commit d604501

Browse files
author
Joshua Nelson
committed
[#41] Fix broken links in documentation
This found several bugs in rustdoc: - rust-lang/rust#81979 - rust-lang/rust#81980 - rust-lang/rust#81981
1 parent 74eee15 commit d604501

File tree

4 files changed

+37
-46
lines changed

4 files changed

+37
-46
lines changed

src/context_api/mod.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -347,14 +347,12 @@ impl Context {
347347
/// ```
348348
///
349349
/// # See Also
350-
/// - [`simple_api::tp_st`](super::simple_api::tp_st())
351350
/// - [More details about the underlying FFI call][C documentation]
352351
/// - [Transaction Processing in YottaDB](https://docs.yottadb.com/MultiLangProgGuide/MultiLangProgGuide.html#transaction-processing)
353352
/// - [Threads and Transaction Processing][threads and transactions]
354353
///
355354
/// [`$zmaxtptime`]: https://docs.yottadb.com/MultiLangProgGuide/MultiLangProgGuide.html#zmaxtptime
356-
/// [`TransactionStatus`]: super::simple_api::TransactionStatus
357-
/// [intrinsics]: crate::simple_api#intrinsic-variables
355+
/// [intrinsics]: crate#intrinsic-variables
358356
/// [threads and transactions]: https://docs.yottadb.com/MultiLangProgGuide/programmingnotes.html#threads-and-transaction-processing
359357
/// [C documentation]: https://docs.yottadb.com/MultiLangProgGuide/cprogram.html#ydb-tp-s-ydb-tp-st
360358
pub fn tp<'a, F>(
@@ -424,7 +422,6 @@ impl Context {
424422
/// ```
425423
///
426424
/// # See also
427-
/// - [`simple_api::delete_excl_st`](super::simple_api::delete_excl_st())
428425
/// - The [Simple API documentation](https://docs.yottadb.com/MultiLangProgGuide/cprogram.html#ydb-delete-excl-s-ydb-delete-excl-st)
429426
/// - [Local and global variables](https://docs.yottadb.com/MultiLangProgGuide/MultiLangProgGuide.html#local-and-global-variables)
430427
/// - [Instrinsic special variables](https://docs.yottadb.com/MultiLangProgGuide/MultiLangProgGuide.html#intrinsic-special-variables)
@@ -590,7 +587,6 @@ impl Context {
590587
///
591588
/// - The C [Simple API documentation](https://docs.yottadb.com/MultiLangProgGuide/cprogram.html#ydb-lock-s-ydb-lock-st)
592589
/// - [Locks](https://docs.yottadb.com/MultiLangProgGuide/MultiLangProgGuide.html#locks)
593-
/// - [`simple_api::lock_st`](super::simple_api::lock_st())
594590
///
595591
/// [`KeyContext::lock_incr`]: KeyContext::lock_incr()
596592
/// [`KeyContext::lock_decr`]: KeyContext::lock_decr()
@@ -611,7 +607,6 @@ impl Context {
611607
/// - `YDB_ERR_UNKNOWNSYSERR` if `status` is an unrecognized status code
612608
///
613609
/// # See also
614-
/// - [`simple_api::message_t`](super::simple_api::message_t())
615610
/// - [`impl Display for YDBError`][`impl Display`], which should meet most use cases for `message_t`.
616611
/// - [Function return codes](https://docs.yottadb.com/MultiLangProgGuide/cprogram.html#function-return-codes)
617612
/// - [ZMessage codes](https://docs.yottadb.com/MessageRecovery/errormsgref.html#zmessage-codes)

src/lib.rs

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,14 @@
1818
//! There are two major APIs:
1919
//! - [`craw`], the FFI bindings generated directly by bindgen.
2020
//! These are not recommended for normal use,
21-
//! but are available in case the `context_api` is missing functionality.
22-
//! - [`context_api`], which is a safe wrapper around the C API which
23-
//! stores the current tptoken and an error buffer
24-
//! so you don't have to keep track of them yourself.
25-
//! The reason this metadata is necessary is because this crate binds to
26-
//! the threaded version of YottaDB, which requires a `tptoken` and `err_buffer`.
27-
//! See [transaction processing] for more details on transactions and `tptoken`s.
28-
//!
29-
//! Most operations are encapsulated in methods in the [KeyContext] struct.
21+
//! but are available in case the Context API is missing functionality.
22+
//! - The main Context API, which is a safe wrapper around the C API which
23+
//! stores the current tptoken and an error buffer so you don't have to keep track of them yourself.
24+
//! The reason this metadata is necessary is because this crate binds to the threaded version of
25+
//! YottaDB, which requires a `tptoken` and `err_buffer`. See [transaction processing] for more
26+
//! details on transactions and `tptoken`s.
27+
//!
28+
//! Most operations are encapsulated in methods in the [`KeyContext`] struct.
3029
//! Iteration helpers are available to iterate over values in the database in a variety of ways.
3130
//!
3231
//! # Examples
@@ -47,6 +46,13 @@
4746
//! }
4847
//! ```
4948
//!
49+
//! # Intrinsic Variables
50+
//!
51+
//! YottaDB has several intrinsic variables which are documented [online][intrinsics].
52+
//! To get the value of these variables, call `get_st` on a `Key` with the name of the variable.
53+
//!
54+
//! ## Example
55+
//!
5056
//! Get the instrinsic variable [`$tlevel`][tlevel], which gives the current transaction level.
5157
//!
5258
//! ```
@@ -62,12 +68,7 @@
6268
//! }
6369
//! ```
6470
//!
65-
//! # Intrinsic Variables
66-
//!
67-
//! YottaDB has several intrinsic variables which are documented [online][intrinsics].
68-
//! To get the value of these variables, call `get_st` on a `Key` with the name of the variable.
69-
//!
70-
//! ## Features
71+
//! # Features
7172
//!
7273
//! Since `yottadb` is a set of bindings to a C library, it uses `bindgen` to generate the bindings.
7374
//! There are two ways to do this:
@@ -78,14 +79,14 @@
7879
//! even when you don't have admin priviledges to install programs.
7980
//! Using a pre-installed version means compile times are much lower.
8081
//!
81-
//! ## Signal handling
82+
//! # Signal handling
8283
//!
8384
//! YottaDB performs its own signal handling in addition to any signal handlers you may have set up.
8485
//! Since many functions in C are not async-safe, it defers any action until the next time `ydb_eintr_handler` is called.
8586
//! All YDB functions will automatically call `ydb_eintr_handler` if necessary,
8687
//! so in most cases this should not affect your application. However, there are some rare cases
8788
//! when the handler will not be called:
88-
//! - If you have a tight loop inside a [`tp`] that does not call a YDB function
89+
//! - If you have a tight loop inside a [`Context::tp`] that does not call a YDB function
8990
//!
9091
//! For example, the following loop will run forever even if sent SIGINT:
9192
//! ```no_run
@@ -101,7 +102,7 @@
101102
//! # }
102103
//! ```
103104
//!
104-
//! To avoid this, call [`eintr_handler`] in the loop:
105+
//! To avoid this, call [`Context::eintr_handler`] in the loop:
105106
//!
106107
//! ```no_run
107108
//! # fn main() -> yottadb::YDBResult<()> {
@@ -126,20 +127,14 @@
126127
//! YottaDB does not register any signal handlers until the first time `ydb_init` is called,
127128
//! and deregisters its handlers after `ydb_exit`.
128129
//!
129-
//! ### See also
130+
//! ## See also
130131
//!
131132
//! - The [C documentation on signals](https://docs.yottadb.com/MultiLangProgGuide/programmingnotes.html#signals)
132-
//! - [`eintr_handler`]
133-
//! - [`eintr_handler_t`]
134-
//! - [`tp`]
135-
//!
136-
//! [`YDBError`]: simple_api::YDBError
137-
//! [`eintr_handler`]: context_api::Context::eintr_handler()
138-
//! [`eintr_handler_t`]: simple_api::eintr_handler_t()
139-
//! [`tp`]: context_api::Context::tp()
133+
//! - [`Context::eintr_handler`]
134+
//! - [`Context::tp`](crate::Context::tp)
135+
//!
140136
//! [YottaDB]: https://yottadb.com/
141137
//! [transaction processing]: https://docs.yottadb.com/MultiLangProgGuide/MultiLangProgGuide.html#transaction-processing
142-
//! [key]: Key
143138
//! [intrinsics]: https://docs.yottadb.com/MultiLangProgGuide/MultiLangProgGuide.html#intrinsic-special-variables
144139
//! [tlevel]: https://docs.yottadb.com/MultiLangProgGuide/MultiLangProgGuide.html#tlevel
145140
#![deny(missing_docs)]
@@ -153,14 +148,15 @@
153148
#[allow(unused)]
154149
const INTERNAL_DOCS: () = ();
155150

156-
// Public to reduce churn when upgrading versions, but it's recommended to use the top-level re-exports instead.
151+
/// Public to reduce churn when upgrading versions, but it's recommended to use the top-level re-exports instead.
157152
#[doc(hidden)]
158-
pub mod context_api;
153+
mod context_api;
159154
#[allow(missing_docs)]
160155
pub mod craw;
161156
mod simple_api;
162157

163158
pub use craw::{YDB_ERR_GVUNDEF, YDB_ERR_LVUNDEF};
159+
#[doc(inline)] // needed because of rust-lang/rust#81890
164160
pub use context_api::*; // glob import so we catch all the iterators
165161
pub use simple_api::{
166162
call_in::{CallInDescriptor, CallInTableDescriptor},

src/simple_api/call_in.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ use std::ffi::{CString, CStr};
2121
use crate::craw::ci_name_descriptor;
2222
use super::{resize_call, YDBResult, TpToken};
2323

24-
/// The descriptor for a call-in table opened with [`ci_tab_open_t`].
24+
/// The descriptor for a call-in table opened with [`ci_tab_open`].
2525
///
2626
/// `CallInTableDescriptor::default()` returns a table which,
27-
/// when called with [`ci_tab_switch_t`], uses the environment variable `ydb_ci`.
27+
/// when called with [`ci_tab_switch`], uses the environment variable `ydb_ci`.
2828
/// This is also the table that is used if `ci_tab_switch_t` is never called.
2929
///
30-
/// [`ci_tab_open_t`]: ci_tab_open_t()
31-
/// [`ci_tab_switch_t`]: ci_tab_switch_t()
30+
/// [`ci_tab_open`]: crate::Context::ci_tab_open
31+
/// [`ci_tab_switch`]: crate::Context::ci_tab_switch
3232
#[derive(Copy, Clone, Debug, Default, Eq, PartialEq)]
3333
pub struct CallInTableDescriptor(usize);
3434

src/simple_api/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
//!
1515
//! The API is not particularly friendly, but it exposes only safe code.
1616
//!
17-
//! Most operations are encapsulated in methods on the [`Key`][key] struct, and generally
17+
//! Most operations are encapsulated in methods on the [`Key`] struct, and generally
1818
//! consume a Vec<u8> and return [`YDBResult<Vec<u8>>`][YDBResult]. The return Vec<u8> will either contain
1919
//! the data fetched from the database or an error.
2020
//!
@@ -97,7 +97,7 @@ pub type YDBResult<T> = Result<T, YDBError>;
9797
/// A transaction processing token, used by yottadb to ensure ACID properties.
9898
///
9999
/// The only valid values for a TpToken are the default (`TpToken::default()`)
100-
/// or a token passed in from [`tp_st`](tp_st()).
100+
/// or a token passed in from [`Context::tp`](crate::Context::tp).
101101
///
102102
/// TpTokens can be converted to `u64`, but not vice-versa.
103103
#[derive(Copy, Clone, Hash, Eq, PartialEq)]
@@ -147,7 +147,7 @@ impl From<TpToken> for u64 {
147147
/// The type of data available at the current node.
148148
///
149149
/// # See also
150-
/// - [`Key::data_st()`]
150+
/// - [`KeyContext::data()`](crate::KeyContext::data)
151151
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
152152
pub enum DataReturn {
153153
/// There is no data present, either here or lower in the tree.
@@ -163,7 +163,7 @@ pub enum DataReturn {
163163
/// The type of deletion that should be carried out.
164164
///
165165
/// # See also
166-
/// - [`Key::delete_st()`]
166+
/// - [`KeyContext::delete_st()`](crate::KeyContext::delete)
167167
#[derive(Debug, Clone, Hash, Eq, PartialEq)]
168168
pub enum DeleteType {
169169
/// Delete only this node.
@@ -817,9 +817,9 @@ impl<S: Into<String>> From<S> for Key {
817817
}
818818
}
819819

820-
/// The status returned from a callback passed to [`tp_st`]
820+
/// The status returned from a callback passed to [`Context::tp`]
821821
///
822-
/// [`tp_st`]: tp_st()
822+
/// [`Context::tp`]: crate::Context::tp
823823
#[derive(Debug, Copy, Clone)]
824824
pub enum TransactionStatus {
825825
/// Complete the transaction and commit all changes

0 commit comments

Comments
 (0)