Skip to content

Commit 84105e6

Browse files
committed
Convert (almost) all cross-references in the documentation to intradoc links
Compiler will check existence of the intradoc links. Cross-references in the Deserializer couldn't be converted to intradoc links, because trait is implemented for `&mut` and rustdoc cannot resolve that links
1 parent 4a76554 commit 84105e6

File tree

6 files changed

+41
-43
lines changed

6 files changed

+41
-43
lines changed

src/de/map.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -517,15 +517,15 @@ where
517517
forward!(deserialize_any);
518518
forward!(deserialize_ignored_any);
519519

520-
/// Tuple representation is the same as [sequences](#method.deserialize_seq).
520+
/// Tuple representation is the same as [sequences](Self::deserialize_seq).
521521
fn deserialize_tuple<V>(self, _len: usize, visitor: V) -> Result<V::Value, DeError>
522522
where
523523
V: Visitor<'de>,
524524
{
525525
self.deserialize_seq(visitor)
526526
}
527527

528-
/// Named tuple representation is the same as [unnamed tuples](#method.deserialize_tuple).
528+
/// Named tuple representation is the same as [unnamed tuples](Self::deserialize_tuple).
529529
fn deserialize_tuple_struct<V>(
530530
self,
531531
_name: &'static str,
@@ -687,15 +687,15 @@ where
687687
forward!(deserialize_any);
688688
forward!(deserialize_ignored_any);
689689

690-
/// Representation of tuples the same as [sequences](#method.deserialize_seq).
690+
/// Representation of tuples the same as [sequences](Self::deserialize_seq).
691691
fn deserialize_tuple<V>(self, _len: usize, visitor: V) -> Result<V::Value, DeError>
692692
where
693693
V: Visitor<'de>,
694694
{
695695
self.deserialize_seq(visitor)
696696
}
697697

698-
/// Representation of named tuples the same as [unnamed tuples](#method.deserialize_tuple).
698+
/// Representation of named tuples the same as [unnamed tuples](Self::deserialize_tuple).
699699
fn deserialize_tuple_struct<V>(
700700
self,
701701
_name: &'static str,

src/errors.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,6 @@ impl From<AttrError> for Error {
7979
}
8080

8181
/// A specialized `Result` type where the error is hard-wired to [`Error`].
82-
///
83-
/// [`Error`]: enum.Error.html
8482
pub type Result<T> = std::result::Result<T, Error>;
8583

8684
impl std::fmt::Display for Error {

src/events/attributes.rs

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,13 @@ use std::{borrow::Cow, collections::HashMap, ops::Range};
1717
/// want to access the value using one of the [`unescaped_value`] and [`unescape_and_decode_value`]
1818
/// functions.
1919
///
20-
/// [`unescaped_value`]: #method.unescaped_value
21-
/// [`unescape_and_decode_value`]: #method.unescape_and_decode_value
20+
/// [`unescaped_value`]: Self::unescaped_value
21+
/// [`unescape_and_decode_value`]: Self::unescape_and_decode_value
2222
#[derive(Clone, PartialEq)]
2323
pub struct Attribute<'a> {
2424
/// The key to uniquely define the attribute.
2525
///
2626
/// If [`Attributes::with_checks`] is turned off, the key might not be unique.
27-
///
28-
/// [`Attributes::with_checks`]: struct.Attributes.html#method.with_checks
2927
pub key: QName<'a>,
3028
/// The raw value of the attribute.
3129
pub value: Cow<'a, [u8]>,
@@ -39,7 +37,7 @@ impl<'a> Attribute<'a> {
3937
///
4038
/// This will allocate if the value contains any escape sequences.
4139
///
42-
/// See also [`unescaped_value_with_custom_entities()`](#method.unescaped_value_with_custom_entities)
40+
/// See also [`unescaped_value_with_custom_entities()`](Self::unescaped_value_with_custom_entities)
4341
pub fn unescaped_value(&self) -> XmlResult<Cow<[u8]>> {
4442
self.make_unescaped_value(None)
4543
}
@@ -52,7 +50,7 @@ impl<'a> Attribute<'a> {
5250
///
5351
/// This will allocate if the value contains any escape sequences.
5452
///
55-
/// See also [`unescaped_value()`](#method.unescaped_value)
53+
/// See also [`unescaped_value()`](Self::unescaped_value)
5654
///
5755
/// # Pre-condition
5856
///
@@ -76,11 +74,11 @@ impl<'a> Attribute<'a> {
7674
/// This allocates a `String` in all cases. For performance reasons it might be a better idea to
7775
/// instead use one of:
7876
///
79-
/// * [`Reader::decode()`], as it only allocates when the decoding can't be performed otherwise.
77+
/// * [`Reader::decoder().decode()`], as it only allocates when the decoding can't be performed otherwise.
8078
/// * [`unescaped_value()`], as it doesn't allocate when no escape sequences are used.
8179
///
82-
/// [`unescaped_value()`]: #method.unescaped_value
83-
/// [`Reader::decode()`]: ../../reader/struct.Reader.html#method.decode
80+
/// [`unescaped_value()`]: Self::unescaped_value
81+
/// [`Reader::decoder().decode()`]: crate::reader::Decoder::decode
8482
pub fn unescape_and_decode_value<B>(&self, reader: &Reader<B>) -> XmlResult<String> {
8583
self.do_unescape_and_decode_value(reader, None)
8684
}
@@ -90,11 +88,11 @@ impl<'a> Attribute<'a> {
9088
/// This allocates a `String` in all cases. For performance reasons it might be a better idea to
9189
/// instead use one of:
9290
///
93-
/// * [`Reader::decode()`], as it only allocates when the decoding can't be performed otherwise.
91+
/// * [`Reader::decoder().decode()`], as it only allocates when the decoding can't be performed otherwise.
9492
/// * [`unescaped_value_with_custom_entities()`], as it doesn't allocate when no escape sequences are used.
9593
///
96-
/// [`unescaped_value_with_custom_entities()`]: #method.unescaped_value_with_custom_entities
97-
/// [`Reader::decode()`]: ../../reader/struct.Reader.html#method.decode
94+
/// [`unescaped_value_with_custom_entities()`]: Self::unescaped_value_with_custom_entities
95+
/// [`Reader::decoder().decode()`]: crate::reader::Decoder::decode
9896
///
9997
/// # Pre-condition
10098
///
@@ -189,7 +187,7 @@ impl<'a> From<Attr<&'a [u8]>> for Attribute<'a> {
189187
/// Yields `Result<Attribute>`. An `Err` will be yielded if an attribute is malformed or duplicated.
190188
/// The duplicate check can be turned off by calling [`with_checks(false)`].
191189
///
192-
/// [`with_checks(false)`]: #method.with_checks
190+
/// [`with_checks(false)`]: Self::with_checks
193191
#[derive(Clone, Debug)]
194192
pub struct Attributes<'a> {
195193
/// slice of `Element` corresponding to attributes

src/events/mod.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,12 @@ impl<'a> From<BytesText<'a>> for BytesStartText<'a> {
108108
///
109109
/// `<name attr="value">`.
110110
///
111-
/// The name can be accessed using the [`name`], [`local_name`] or [`unescaped`] methods. An
112-
/// iterator over the attributes is returned by the [`attributes`] method.
111+
/// The name can be accessed using the [`name`] or [`local_name`] methods.
112+
/// An iterator over the attributes is returned by the [`attributes`] method.
113113
///
114-
/// [`name`]: #method.name
115-
/// [`local_name`]: #method.local_name
116-
/// [`unescaped`]: #method.unescaped
117-
/// [`attributes`]: #method.attributes
114+
/// [`name`]: Self::name
115+
/// [`local_name`]: Self::local_name
116+
/// [`attributes`]: Self::attributes
118117
#[derive(Clone, Eq, PartialEq)]
119118
pub struct BytesStart<'a> {
120119
/// content of the element, before any utf8 conversion
@@ -203,7 +202,7 @@ impl<'a> BytesStart<'a> {
203202
/// # }}
204203
/// ```
205204
///
206-
/// [`to_end`]: #method.to_end
205+
/// [`to_end`]: Self::to_end
207206
pub fn to_borrowed(&self) -> BytesStart {
208207
BytesStart::borrowed(&self.buf, self.name_len)
209208
}
@@ -718,7 +717,7 @@ impl<'a> BytesText<'a> {
718717
/// Searches for '&' into content and try to escape the coded character if possible
719718
/// returns Malformed error with index within element if '&' is not followed by ';'
720719
///
721-
/// See also [`unescaped_with_custom_entities()`](#method.unescaped_with_custom_entities)
720+
/// See also [`unescaped_with_custom_entities()`](Self::unescaped_with_custom_entities)
722721
pub fn unescaped(&self) -> Result<Cow<[u8]>> {
723722
self.make_unescaped(None)
724723
}
@@ -733,7 +732,7 @@ impl<'a> BytesText<'a> {
733732
///
734733
/// The keys and values of `custom_entities`, if any, must be valid UTF-8.
735734
///
736-
/// See also [`unescaped()`](#method.unescaped)
735+
/// See also [`unescaped()`](Self::unescaped)
737736
pub fn unescaped_with_custom_entities<'s>(
738737
&'s self,
739738
custom_entities: &HashMap<Vec<u8>, Vec<u8>>,

src/reader.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,9 @@ impl<R> Reader<R> {
234234
///
235235
/// (`false` by default)
236236
///
237-
/// [`Empty`]: events/enum.Event.html#variant.Empty
238-
/// [`Start`]: events/enum.Event.html#variant.Start
239-
/// [`End`]: events/enum.Event.html#variant.End
237+
/// [`Empty`]: Event::Empty
238+
/// [`Start`]: Event::Start
239+
/// [`End`]: Event::End
240240
pub fn expand_empty_elements(&mut self, val: bool) -> &mut Self {
241241
self.expand_empty_elements = val;
242242
self
@@ -249,7 +249,7 @@ impl<R> Reader<R> {
249249
///
250250
/// (`false` by default)
251251
///
252-
/// [`Text`]: events/enum.Event.html#variant.Text
252+
/// [`Text`]: Event::Text
253253
pub fn trim_text(&mut self, val: bool) -> &mut Self {
254254
self.trim_text_start = val;
255255
self.trim_text_end = val;
@@ -262,7 +262,7 @@ impl<R> Reader<R> {
262262
///
263263
/// (`false` by default)
264264
///
265-
/// [`Text`]: events/enum.Event.html#variant.Text
265+
/// [`Text`]: Event::Text
266266
pub fn trim_text_end(&mut self, val: bool) -> &mut Self {
267267
self.trim_text_end = val;
268268
self
@@ -278,7 +278,7 @@ impl<R> Reader<R> {
278278
///
279279
/// (`true` by default)
280280
///
281-
/// [`End`]: events/enum.Event.html#variant.End
281+
/// [`End`]: Event::End
282282
pub fn trim_markup_names_in_closing_tags(&mut self, val: bool) -> &mut Self {
283283
self.trim_markup_names_in_closing_tags = val;
284284
self
@@ -300,7 +300,7 @@ impl<R> Reader<R> {
300300
///
301301
/// (`true` by default)
302302
///
303-
/// [`End`]: events/enum.Event.html#variant.End
303+
/// [`End`]: Event::End
304304
pub fn check_end_names(&mut self, val: bool) -> &mut Self {
305305
self.check_end_names = val;
306306
self
@@ -315,7 +315,7 @@ impl<R> Reader<R> {
315315
///
316316
/// (`false` by default)
317317
///
318-
/// [`Comment`]: events/enum.Event.html#variant.Comment
318+
/// [`Comment`]: Event::Comment
319319
pub fn check_comments(&mut self, val: bool) -> &mut Self {
320320
self.check_comments = val;
321321
self

src/writer.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,15 @@ impl<W: Write> Writer<W> {
152152

153153
/// Manually write a newline and indentation at the proper level.
154154
///
155-
/// This can be used when the heuristic to line break and indent after any [Event] apart
156-
/// from [Text] fails such as when a [Start] occurs directly after [Text].
157-
/// This method will do nothing if `Writer` was not constructed with `new_with_indent`.
155+
/// This can be used when the heuristic to line break and indent after any
156+
/// [`Event`] apart from [`Text`] fails such as when a [`Start`] occurs directly
157+
/// after [`Text`].
158158
///
159-
/// [Event]: events/enum.Event.html
160-
/// [Text]: events/enum.Event.html#variant.Text
161-
/// [Start]: events/enum.Event.html#variant.Start
159+
/// This method will do nothing if `Writer` was not constructed with [`new_with_indent`].
160+
///
161+
/// [`Text`]: Event::Text
162+
/// [`Start`]: Event::Start
163+
/// [`new_with_indent`]: Self::new_with_indent
162164
pub fn write_indent(&mut self) -> Result<()> {
163165
if let Some(ref i) = self.indent {
164166
self.writer.write_all(b"\n").map_err(Error::Io)?;
@@ -171,7 +173,8 @@ impl<W: Write> Writer<W> {
171173

172174
/// Provides a simple, high-level API for writing XML elements.
173175
///
174-
/// Returns an [ElementWriter] that simplifies setting attributes and writing content inside the element.
176+
/// Returns an [`ElementWriter`] that simplifies setting attributes and writing
177+
/// content inside the element.
175178
///
176179
/// # Example
177180
///

0 commit comments

Comments
 (0)