Skip to content

Commit b8a207c

Browse files
committed
docs: Clarify summary for types
1 parent dc1ee5b commit b8a207c

File tree

9 files changed

+35
-33
lines changed

9 files changed

+35
-33
lines changed

crates/toml_edit/src/array.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ use crate::repr::Decor;
55
use crate::value::{DEFAULT_LEADING_VALUE_DECOR, DEFAULT_VALUE_DECOR};
66
use crate::{Item, RawString, Value};
77

8-
/// Type representing a TOML array,
9-
/// payload of the `Value::Array` variant's value
8+
/// A TOML [`Value`] that contains a sequence of [`Value`]s
109
#[derive(Debug, Default, Clone)]
1110
pub struct Array {
1211
// `trailing` represents whitespaces, newlines
@@ -20,11 +19,11 @@ pub struct Array {
2019
pub(crate) values: Vec<Item>,
2120
}
2221

23-
/// An owned iterator type over `Table`'s key/value pairs.
22+
/// An owned iterator type over [`Array`]'s [`Value`]s
2423
pub type ArrayIntoIter = Box<dyn Iterator<Item = Value>>;
25-
/// An iterator type over `Array`'s values.
24+
/// An iterator type over [`Array`]'s [`Value`]s
2625
pub type ArrayIter<'a> = Box<dyn Iterator<Item = &'a Value> + 'a>;
27-
/// An iterator type over `Array`'s values.
26+
/// An iterator type over [`Array`]'s [`Value`]s
2827
pub type ArrayIterMut<'a> = Box<dyn Iterator<Item = &'a mut Value> + 'a>;
2928

3029
/// Constructors

crates/toml_edit/src/array_of_tables.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::iter::FromIterator;
22

33
use crate::{Array, Item, Table};
44

5-
/// Type representing a TOML array of tables
5+
/// A top-level sequence of [`Table`]s, each under their own header
66
#[derive(Clone, Debug, Default)]
77
pub struct ArrayOfTables {
88
// Always Vec<Item::Table>, just `Item` to make `Index` work
@@ -109,11 +109,11 @@ impl ArrayOfTables {
109109
}
110110
}
111111

112-
/// An iterator type over `ArrayOfTables`'s values.
112+
/// An iterator type over [`ArrayOfTables`]'s [`Table`]s
113113
pub type ArrayOfTablesIter<'a> = Box<dyn Iterator<Item = &'a Table> + 'a>;
114-
/// An iterator type over `ArrayOfTables`'s values.
114+
/// An iterator type over [`ArrayOfTables`]'s [`Table`]s
115115
pub type ArrayOfTablesIterMut<'a> = Box<dyn Iterator<Item = &'a mut Table> + 'a>;
116-
/// An iterator type over `ArrayOfTables`'s values.
116+
/// An iterator type over [`ArrayOfTables`]'s [`Table`]s
117117
pub type ArrayOfTablesIntoIter = Box<dyn Iterator<Item = Table>>;
118118

119119
impl Extend<Table> for ArrayOfTables {

crates/toml_edit/src/document.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::str::FromStr;
33
use crate::table::Iter;
44
use crate::{Item, RawString, Table};
55

6-
/// Type representing a parsed TOML document
6+
/// The root TOML [`Table`], containing [`Key`][crate::Key]/[`Value`][crate::Value] pairs and all other logic [`Table`]s
77
#[derive(Debug, Clone)]
88
pub struct ImDocument<S> {
99
pub(crate) root: Item,
@@ -105,7 +105,7 @@ impl<S> std::ops::Deref for ImDocument<S> {
105105
}
106106
}
107107

108-
/// Type representing a TOML document
108+
/// The editable root TOML [`Table`], containing [`Key`][crate::Key]/[`Value`][crate::Value] pairs and all other logic [`Table`]s
109109
#[derive(Debug, Clone)]
110110
pub struct DocumentMut {
111111
pub(crate) root: Item,

crates/toml_edit/src/error.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::error::Error as StdError;
22
use std::fmt::{Display, Formatter, Result};
33

4-
/// Type representing a TOML parse error
4+
/// A TOML parse error
55
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
66
pub struct TomlError {
77
message: String,

crates/toml_edit/src/inline_table.rs

+7-8
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ use crate::repr::Decor;
55
use crate::table::{Iter, IterMut, KeyValuePairs, TableLike};
66
use crate::{InternalString, Item, KeyMut, RawString, Table, Value};
77

8-
/// Type representing a TOML inline table,
9-
/// payload of the `Value::InlineTable` variant
8+
/// A TOML [`Value`] that contains a collection of [`Key`]/[`Value`] pairs
109
#[derive(Debug, Default, Clone)]
1110
pub struct InlineTable {
1211
// `preamble` represents whitespaces in an empty table
@@ -511,11 +510,11 @@ fn decorate_inline_table(table: &mut InlineTable) {
511510
}
512511
}
513512

514-
/// An owned iterator type over key/value pairs of an inline table.
513+
/// An owned iterator type over an [`InlineTable`]'s [`Key`]/[`Value`] pairs
515514
pub type InlineTableIntoIter = Box<dyn Iterator<Item = (InternalString, Value)>>;
516-
/// An iterator type over key/value pairs of an inline table.
515+
/// An iterator type over [`InlineTable`]'s [`Key`]/[`Value`] pairs
517516
pub type InlineTableIter<'a> = Box<dyn Iterator<Item = (&'a str, &'a Value)> + 'a>;
518-
/// A mutable iterator type over key/value pairs of an inline table.
517+
/// A mutable iterator type over [`InlineTable`]'s [`Key`]/[`Value`] pairs
519518
pub type InlineTableIterMut<'a> = Box<dyn Iterator<Item = (KeyMut<'a>, &'a mut Value)> + 'a>;
520519

521520
impl TableLike for InlineTable {
@@ -613,7 +612,7 @@ impl TableLike for InlineTable {
613612
// `{ key1 = value1, ... }`
614613
pub(crate) const DEFAULT_INLINE_KEY_DECOR: (&str, &str) = (" ", " ");
615614

616-
/// A view into a single location in a map, which may be vacant or occupied.
615+
/// A view into a single location in an [`InlineTable`], which may be vacant or occupied.
617616
pub enum InlineEntry<'a> {
618617
/// An occupied Entry.
619618
Occupied(InlineOccupiedEntry<'a>),
@@ -659,7 +658,7 @@ impl<'a> InlineEntry<'a> {
659658
}
660659
}
661660

662-
/// A view into a single occupied location in a `IndexMap`.
661+
/// A view into a single occupied location in an [`InlineTable`].
663662
pub struct InlineOccupiedEntry<'a> {
664663
entry: indexmap::map::OccupiedEntry<'a, Key, Item>,
665664
}
@@ -714,7 +713,7 @@ impl<'a> InlineOccupiedEntry<'a> {
714713
}
715714
}
716715

717-
/// A view into a single empty location in a `IndexMap`.
716+
/// A view into a single empty location in an [`InlineTable`].
718717
pub struct InlineVacantEntry<'a> {
719718
entry: indexmap::map::VacantEntry<'a, Key, Item>,
720719
}

crates/toml_edit/src/key.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ use std::str::FromStr;
44
use crate::repr::{Decor, Repr};
55
use crate::InternalString;
66

7-
/// Key as part of a Key/Value Pair or a table header.
7+
/// For Key/[`Value`][crate::Value] pairs under a [`Table`][crate::Table] header or inside an
8+
/// [`InlineTable`][crate::InlineTable]
89
///
910
/// # Examples
1011
///
@@ -333,7 +334,7 @@ impl From<Key> for InternalString {
333334
}
334335
}
335336

336-
/// A mutable reference to a `Key`'s formatting
337+
/// A mutable reference to a [`Key`]'s formatting
337338
#[derive(Debug, Eq, PartialEq, PartialOrd, Ord, Hash)]
338339
pub struct KeyMut<'k> {
339340
key: &'k mut Key,

crates/toml_edit/src/repr.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ use std::borrow::Cow;
22

33
use crate::RawString;
44

5-
/// A value together with its `to_string` representation,
6-
/// including surrounding it whitespaces and comments.
5+
/// A scalar TOML [`Value`][crate::Value]'s logical value and its representation in a `&str`
6+
///
7+
/// This includes the surrounding whitespace and comments.
78
#[derive(Eq, PartialEq, Clone, Hash)]
89
pub struct Formatted<T> {
910
value: T,
@@ -134,7 +135,7 @@ mod inner {
134135
impl ValueRepr for toml_datetime::Datetime {}
135136
}
136137

137-
/// TOML-encoded value
138+
/// A TOML [`Value`][crate::Value] encoded as a `&str`
138139
#[derive(Eq, PartialEq, Clone, Hash)]
139140
pub struct Repr {
140141
raw_value: RawString,

crates/toml_edit/src/table.rs

+8-7
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ use crate::repr::Decor;
77
use crate::value::DEFAULT_VALUE_DECOR;
88
use crate::{InlineTable, InternalString, Item, KeyMut, Value};
99

10-
/// Type representing a TOML non-inline table
10+
/// A TOML table, a top-level collection of key/[`Value`] pairs under a header and logical
11+
/// sub-tables
1112
#[derive(Clone, Debug, Default)]
1213
pub struct Table {
1314
// Comments/spaces before and after the header
@@ -524,11 +525,11 @@ pub(crate) const DEFAULT_KEY_DECOR: (&str, &str) = ("", " ");
524525
pub(crate) const DEFAULT_TABLE_DECOR: (&str, &str) = ("\n", "");
525526
pub(crate) const DEFAULT_KEY_PATH_DECOR: (&str, &str) = ("", "");
526527

527-
/// An owned iterator type over `Table`'s key/value pairs.
528+
/// An owned iterator type over [`Table`]'s [`Key`]/[`Item`] pairs
528529
pub type IntoIter = Box<dyn Iterator<Item = (InternalString, Item)>>;
529-
/// An iterator type over `Table`'s key/value pairs.
530+
/// An iterator type over [`Table`]'s [`Key`]/[`Item`] pairs
530531
pub type Iter<'a> = Box<dyn Iterator<Item = (&'a str, &'a Item)> + 'a>;
531-
/// A mutable iterator type over `Table`'s key/value pairs.
532+
/// A mutable iterator type over [`Table`]'s [`Key`]/[`Item`] pairs
532533
pub type IterMut<'a> = Box<dyn Iterator<Item = (KeyMut<'a>, &'a mut Item)> + 'a>;
533534

534535
/// This trait represents either a `Table`, or an `InlineTable`.
@@ -664,7 +665,7 @@ impl TableLike for Table {
664665
}
665666
}
666667

667-
/// A view into a single location in a map, which may be vacant or occupied.
668+
/// A view into a single location in a [`Table`], which may be vacant or occupied.
668669
pub enum Entry<'a> {
669670
/// An occupied Entry.
670671
Occupied(OccupiedEntry<'a>),
@@ -710,7 +711,7 @@ impl<'a> Entry<'a> {
710711
}
711712
}
712713

713-
/// A view into a single occupied location in a `IndexMap`.
714+
/// A view into a single occupied location in a [`Table`].
714715
pub struct OccupiedEntry<'a> {
715716
pub(crate) entry: indexmap::map::OccupiedEntry<'a, Key, Item>,
716717
}
@@ -764,7 +765,7 @@ impl<'a> OccupiedEntry<'a> {
764765
}
765766
}
766767

767-
/// A view into a single empty location in a `IndexMap`.
768+
/// A view into a single empty location in a [`Table`].
768769
pub struct VacantEntry<'a> {
769770
pub(crate) entry: indexmap::map::VacantEntry<'a, Key, Item>,
770771
}

crates/toml_edit/src/value.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ use crate::key::Key;
77
use crate::repr::{Decor, Formatted};
88
use crate::{Array, InlineTable, InternalString, RawString};
99

10-
/// Representation of a TOML Value (as part of a Key/Value Pair).
10+
/// For [`Key`]/Value pairs under a [`Table`][crate::Table] header or inside another
11+
/// Value
1112
#[derive(Debug, Clone)]
1213
pub enum Value {
1314
/// A string value.

0 commit comments

Comments
 (0)