Fix doc link import style to avoid unused_imports (#15337)

# Objective

- Fixes:  #15323
This commit is contained in:
Shadowcat650 2024-09-20 17:04:32 -07:00 committed by GitHub
parent 48f2bd410b
commit 417e6ccaf1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 26 additions and 36 deletions

View File

@ -11,10 +11,7 @@ use thiserror::Error;
use super::{ErasedAssetReader, ErasedAssetWriter};
#[allow(unused_imports, reason = "Needed for documentation links.")]
use crate::io::{AssetReader, AssetWriter};
/// A reference to an "asset source", which maps to an [`AssetReader`] and/or [`AssetWriter`].
/// A reference to an "asset source", which maps to an [`AssetReader`](crate::io::AssetReader) and/or [`AssetWriter`](crate::io::AssetWriter).
///
/// * [`AssetSourceId::Default`] corresponds to "default asset paths" that don't specify a source: `/path/to/asset.png`
/// * [`AssetSourceId::Name`] corresponds to asset paths that _do_ specify a source: `remote://path/to/asset.png`, where `remote` is the name.
@ -126,7 +123,7 @@ impl<'a> PartialEq for AssetSourceId<'a> {
}
}
/// Metadata about an "asset source", such as how to construct the [`AssetReader`] and [`AssetWriter`] for the source,
/// Metadata about an "asset source", such as how to construct the [`AssetReader`](crate::io::AssetReader) and [`AssetWriter`](crate::io::AssetWriter) for the source,
/// and whether or not the source is processed.
#[derive(Default)]
pub struct AssetSourceBuilder {
@ -209,7 +206,7 @@ impl AssetSourceBuilder {
Some(source)
}
/// Will use the given `reader` function to construct unprocessed [`AssetReader`] instances.
/// Will use the given `reader` function to construct unprocessed [`AssetReader`](crate::io::AssetReader) instances.
pub fn with_reader(
mut self,
reader: impl FnMut() -> Box<dyn ErasedAssetReader> + Send + Sync + 'static,
@ -218,7 +215,7 @@ impl AssetSourceBuilder {
self
}
/// Will use the given `writer` function to construct unprocessed [`AssetWriter`] instances.
/// Will use the given `writer` function to construct unprocessed [`AssetWriter`](crate::io::AssetWriter) instances.
pub fn with_writer(
mut self,
writer: impl FnMut(bool) -> Option<Box<dyn ErasedAssetWriter>> + Send + Sync + 'static,
@ -239,7 +236,7 @@ impl AssetSourceBuilder {
self
}
/// Will use the given `reader` function to construct processed [`AssetReader`] instances.
/// Will use the given `reader` function to construct processed [`AssetReader`](crate::io::AssetReader) instances.
pub fn with_processed_reader(
mut self,
reader: impl FnMut() -> Box<dyn ErasedAssetReader> + Send + Sync + 'static,
@ -248,7 +245,7 @@ impl AssetSourceBuilder {
self
}
/// Will use the given `writer` function to construct processed [`AssetWriter`] instances.
/// Will use the given `writer` function to construct processed [`AssetWriter`](crate::io::AssetWriter) instances.
pub fn with_processed_writer(
mut self,
writer: impl FnMut(bool) -> Option<Box<dyn ErasedAssetWriter>> + Send + Sync + 'static,
@ -308,7 +305,7 @@ impl AssetSourceBuilder {
}
}
/// A [`Resource`] that hold (repeatable) functions capable of producing new [`AssetReader`] and [`AssetWriter`] instances
/// A [`Resource`] that hold (repeatable) functions capable of producing new [`AssetReader`](crate::io::AssetReader) and [`AssetWriter`](crate::io::AssetWriter) instances
/// for a given asset source.
#[derive(Resource, Default)]
pub struct AssetSourceBuilders {
@ -371,7 +368,7 @@ impl AssetSourceBuilders {
}
}
/// A collection of unprocessed and processed [`AssetReader`], [`AssetWriter`], and [`AssetWatcher`] instances
/// A collection of unprocessed and processed [`AssetReader`](crate::io::AssetReader), [`AssetWriter`](crate::io::AssetWriter), and [`AssetWatcher`] instances
/// for a specific asset source, identified by an [`AssetSourceId`].
pub struct AssetSource {
id: AssetSourceId<'static>,
@ -397,13 +394,13 @@ impl AssetSource {
self.id.clone()
}
/// Return's this source's unprocessed [`AssetReader`].
/// Return's this source's unprocessed [`AssetReader`](crate::io::AssetReader).
#[inline]
pub fn reader(&self) -> &dyn ErasedAssetReader {
&*self.reader
}
/// Return's this source's unprocessed [`AssetWriter`], if it exists.
/// Return's this source's unprocessed [`AssetWriter`](crate::io::AssetWriter), if it exists.
#[inline]
pub fn writer(&self) -> Result<&dyn ErasedAssetWriter, MissingAssetWriterError> {
self.writer
@ -411,7 +408,7 @@ impl AssetSource {
.ok_or_else(|| MissingAssetWriterError(self.id.clone_owned()))
}
/// Return's this source's processed [`AssetReader`], if it exists.
/// Return's this source's processed [`AssetReader`](crate::io::AssetReader), if it exists.
#[inline]
pub fn processed_reader(
&self,
@ -421,7 +418,7 @@ impl AssetSource {
.ok_or_else(|| MissingProcessedAssetReaderError(self.id.clone_owned()))
}
/// Return's this source's processed [`AssetWriter`], if it exists.
/// Return's this source's processed [`AssetWriter`](crate::io::AssetWriter), if it exists.
#[inline]
pub fn processed_writer(
&self,
@ -451,7 +448,7 @@ impl AssetSource {
self.processed_writer.is_some()
}
/// Returns a builder function for this platform's default [`AssetReader`]. `path` is the relative path to
/// Returns a builder function for this platform's default [`AssetReader`](crate::io::AssetReader). `path` is the relative path to
/// the asset root.
pub fn get_default_reader(
_path: String,
@ -466,7 +463,7 @@ impl AssetSource {
}
}
/// Returns a builder function for this platform's default [`AssetWriter`]. `path` is the relative path to
/// Returns a builder function for this platform's default [`AssetWriter`](crate::io::AssetWriter). `path` is the relative path to
/// the asset root. This will return [`None`] if this platform does not support writing assets by default.
pub fn get_default_writer(
_path: String,
@ -557,7 +554,7 @@ impl AssetSource {
}
}
/// This will cause processed [`AssetReader`] futures (such as [`AssetReader::read`]) to wait until
/// This will cause processed [`AssetReader`](crate::io::AssetReader) futures (such as [`AssetReader::read`](crate::io::AssetReader::read)) to wait until
/// the [`AssetProcessor`](crate::AssetProcessor) has finished processing the requested asset.
pub fn gate_on_processor(&mut self, processor_data: Arc<AssetProcessorData>) {
if let Some(reader) = self.processed_reader.take() {
@ -619,7 +616,7 @@ impl AssetSources {
.chain(Some(AssetSourceId::Default))
}
/// This will cause processed [`AssetReader`] futures (such as [`AssetReader::read`]) to wait until
/// This will cause processed [`AssetReader`](crate::io::AssetReader) futures (such as [`AssetReader::read`](crate::io::AssetReader::read)) to wait until
/// the [`AssetProcessor`](crate::AssetProcessor) has finished processing the requested asset.
pub fn gate_on_processor(&mut self, processor_data: Arc<AssetProcessorData>) {
for source in self.iter_processed_mut() {
@ -633,17 +630,17 @@ impl AssetSources {
#[error("Asset Source '{0}' does not exist")]
pub struct MissingAssetSourceError(AssetSourceId<'static>);
/// An error returned when an [`AssetWriter`] does not exist for a given id.
/// An error returned when an [`AssetWriter`](crate::io::AssetWriter) does not exist for a given id.
#[derive(Error, Debug, Clone)]
#[error("Asset Source '{0}' does not have an AssetWriter.")]
pub struct MissingAssetWriterError(AssetSourceId<'static>);
/// An error returned when a processed [`AssetReader`] does not exist for a given id.
/// An error returned when a processed [`AssetReader`](crate::io::AssetReader) does not exist for a given id.
#[derive(Error, Debug, Clone, PartialEq, Eq)]
#[error("Asset Source '{0}' does not have a processed AssetReader.")]
pub struct MissingProcessedAssetReaderError(AssetSourceId<'static>);
/// An error returned when a processed [`AssetWriter`] does not exist for a given id.
/// An error returned when a processed [`AssetWriter`](crate::io::AssetWriter) does not exist for a given id.
#[derive(Error, Debug, Clone)]
#[error("Asset Source '{0}' does not have a processed AssetWriter.")]
pub struct MissingProcessedAssetWriterError(AssetSourceId<'static>);

View File

@ -75,11 +75,7 @@ use std::{
};
use thiserror::Error;
// Needed for doc strings
#[allow(unused_imports, reason = "Needed for documentation links.")]
use crate::io::{AssetReader, AssetWriter};
/// A "background" asset processor that reads asset values from a source [`AssetSource`] (which corresponds to an [`AssetReader`] / [`AssetWriter`] pair),
/// A "background" asset processor that reads asset values from a source [`AssetSource`] (which corresponds to an [`AssetReader`](crate::io::AssetReader) / [`AssetWriter`](crate::io::AssetWriter) pair),
/// processes them in some way, and writes them to a destination [`AssetSource`].
///
/// This will create .meta files (a human-editable serialized form of [`AssetMeta`]) in the source [`AssetSource`] for assets that
@ -212,9 +208,9 @@ impl AssetProcessor {
/// Processes all assets. This will:
/// * For each "processed [`AssetSource`]:
/// * Scan the [`ProcessorTransactionLog`] and recover from any failures detected
/// * Scan the processed [`AssetReader`] to build the current view of already processed assets.
/// * Scan the unprocessed [`AssetReader`] and remove any final processed assets that are invalid or no longer exist.
/// * For each asset in the unprocessed [`AssetReader`], kick off a new "process job", which will process the asset
/// * Scan the processed [`AssetReader`](crate::io::AssetReader) to build the current view of already processed assets.
/// * Scan the unprocessed [`AssetReader`](crate::io::AssetReader) and remove any final processed assets that are invalid or no longer exist.
/// * For each asset in the unprocessed [`AssetReader`](crate::io::AssetReader), kick off a new "process job", which will process the asset
/// (if the latest version of the asset has not been processed).
#[cfg(all(not(target_arch = "wasm32"), feature = "multi_threaded"))]
pub fn process_assets(&self) {

View File

@ -32,10 +32,7 @@ use std::{any::TypeId, path::Path, sync::Arc};
use std::{future::Future, panic::AssertUnwindSafe};
use thiserror::Error;
#[allow(unused_imports, reason = "Needed for documentation links.")]
use crate::io::{AssetReader, AssetWriter};
/// Loads and tracks the state of [`Asset`] values from a configured [`AssetReader`]. This can be used to kick off new asset loads and
/// Loads and tracks the state of [`Asset`] values from a configured [`AssetReader`](crate::io::AssetReader). This can be used to kick off new asset loads and
/// retrieve their current load states.
///
/// The general process to load an asset is:
@ -75,7 +72,7 @@ pub enum AssetServerMode {
}
impl AssetServer {
/// Create a new instance of [`AssetServer`]. If `watch_for_changes` is true, the [`AssetReader`] storage will watch for changes to
/// Create a new instance of [`AssetServer`]. If `watch_for_changes` is true, the [`AssetReader`](crate::io::AssetReader) storage will watch for changes to
/// asset sources and hot-reload them.
pub fn new(sources: AssetSources, mode: AssetServerMode, watching_for_changes: bool) -> Self {
Self::new_with_loaders(
@ -87,7 +84,7 @@ impl AssetServer {
)
}
/// Create a new instance of [`AssetServer`]. If `watch_for_changes` is true, the [`AssetReader`] storage will watch for changes to
/// Create a new instance of [`AssetServer`]. If `watch_for_changes` is true, the [`AssetReader`](crate::io::AssetReader) storage will watch for changes to
/// asset sources and hot-reload them.
pub fn new_with_meta_check(
sources: AssetSources,