[librsvg: 1/17] lib.rs: links to doc items by name




commit bfa616da57d8c491d4860defc954644ebc0d15ba
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Jun 22 14:34:55 2021 -0500

    lib.rs: links to doc items by name
    
    This is possible since Rust 1.48; since librsvg now requires Rust 1.52
    we can use this now.
    
    Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/552>

 src/api.rs | 23 +++++++++--------------
 src/lib.rs | 13 ++++---------
 2 files changed, 13 insertions(+), 23 deletions(-)
---
diff --git a/src/api.rs b/src/api.rs
index 31199aef..be33127a 100644
--- a/src/api.rs
+++ b/src/api.rs
@@ -23,16 +23,14 @@ use crate::{
     url_resolver::UrlResolver,
 };
 
-/// Builder for loading an [`SvgHandle`][SvgHandle].
+/// Builder for loading an [`SvgHandle`].
 ///
 /// This is the starting point for using librsvg.  This struct
-/// implements a builder pattern for configuring an
-/// [`SvgHandle`][SvgHandle]'s options, and then loading the SVG data.
-/// You can call the methods of `Loader` in sequence to configure
-/// how SVG data should be loaded, and finally use one of the loading
-/// functions to load an [`SvgHandle`][SvgHandle].
-///
-/// [SvgHandle]: struct.SvgHandle.html
+/// implements a builder pattern for configuring an [`SvgHandle`]'s
+/// options, and then loading the SVG data.  You can call the methods
+/// of `Loader` in sequence to configure how SVG data should be
+/// loaded, and finally use one of the loading functions to load an
+/// [`SvgHandle`].
 #[derive(Default)]
 pub struct Loader {
     unlimited_size: bool,
@@ -159,9 +157,8 @@ impl Loader {
 
     /// Reads an SVG stream from a `gio::InputStream`.
     ///
-    /// This is similar to the [`read`](#method.read) method, but
-    /// takes a `gio::InputStream`.  The `base_file`, if it is not
-    /// `None`, is used to extract the base URL for this stream.
+    /// The `base_file`, if it is not `None`, is used to extract the
+    /// [base URL][crate#the-base-file-and-resolving-references-to-external-files] for this stream.
     ///
     /// Reading an SVG document may involve resolving relative URLs if the
     /// SVG references things like raster images, or other SVG files.
@@ -216,7 +213,7 @@ fn url_from_file(file: &gio::File) -> Result<Url, LoadingError> {
 /// Handle used to hold SVG data in memory.
 ///
 /// You can create this from one of the `read` methods in
-/// [`Loader`](#struct.Loader.html).
+/// [`Loader`].
 pub struct SvgHandle(Handle);
 
 impl SvgHandle {
@@ -270,8 +267,6 @@ const DEFAULT_DPI_Y: f64 = 96.0;
 /// <svg xmlns="http://www.w3.org/2000/svg"; width="100" height="400">
 /// ```
 /// In this case, the length fields will be set to `Some()`, and `vbox` to `None`.
-///
-/// [`CairoRenderer::intrinsic_dimensions`]: struct.CairoRenderer.html#method.intrinsic_dimensions
 pub struct IntrinsicDimensions {
     /// `width` attribute of the `<svg>`, if present
     pub width: Option<Length>,
diff --git a/src/lib.rs b/src/lib.rs
index 165e56d0..79eb3a9f 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -71,10 +71,6 @@
 //! }
 //! ```
 //!
-//! [`Loader`]: api/struct.Loader.html
-//! [`SvgHandle`]: api/struct.SvgHandle.html
-//! [`CairoRenderer`]: api/struct.CairoRenderer.html
-//!
 //! # The "base file" and resolving references to external files
 //!
 //! When you load an SVG, librsvg needs to know the location of the "base file"
@@ -110,11 +106,10 @@
 //! file.
 //!
 //! 2. All other URL schemes in references require a base URL.  For
-//! example, this means that if you load an SVG with
-//! [`Loader.read`](api/struct.Loader.html#method.read) without
-//! providing a `base_url`, then any referenced files will not be
-//! allowed (e.g. raster images to be loaded from other files will not
-//! work).
+//! example, this means that if you load an SVG with [`Loader::read_stream`]
+//! without providing a `base_file`, then any referenced files will not
+//! be allowed (e.g. raster images to be loaded from other files will
+//! not work).
 //!
 //! 3. If referenced URLs are absolute, rather than relative, then
 //! they must have the same scheme as the base URL.  For example, if


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]