Fix doc link import style to avoid unused_imports (#15337)
# Objective - Fixes: #15323
This commit is contained in:
		
							parent
							
								
									48f2bd410b
								
							
						
					
					
						commit
						417e6ccaf1
					
				| @ -11,10 +11,7 @@ use thiserror::Error; | |||||||
| 
 | 
 | ||||||
| use super::{ErasedAssetReader, ErasedAssetWriter}; | use super::{ErasedAssetReader, ErasedAssetWriter}; | ||||||
| 
 | 
 | ||||||
| #[allow(unused_imports, reason = "Needed for documentation links.")] | /// A reference to an "asset source", which maps to an [`AssetReader`](crate::io::AssetReader) and/or [`AssetWriter`](crate::io::AssetWriter).
 | ||||||
| use crate::io::{AssetReader, AssetWriter}; |  | ||||||
| 
 |  | ||||||
| /// A reference to an "asset source", which maps to an [`AssetReader`] and/or [`AssetWriter`].
 |  | ||||||
| ///
 | ///
 | ||||||
| /// * [`AssetSourceId::Default`] corresponds to "default asset paths" that don't specify a source: `/path/to/asset.png`
 | /// * [`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.
 | /// * [`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.
 | /// and whether or not the source is processed.
 | ||||||
| #[derive(Default)] | #[derive(Default)] | ||||||
| pub struct AssetSourceBuilder { | pub struct AssetSourceBuilder { | ||||||
| @ -209,7 +206,7 @@ impl AssetSourceBuilder { | |||||||
|         Some(source) |         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( |     pub fn with_reader( | ||||||
|         mut self, |         mut self, | ||||||
|         reader: impl FnMut() -> Box<dyn ErasedAssetReader> + Send + Sync + 'static, |         reader: impl FnMut() -> Box<dyn ErasedAssetReader> + Send + Sync + 'static, | ||||||
| @ -218,7 +215,7 @@ impl AssetSourceBuilder { | |||||||
|         self |         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( |     pub fn with_writer( | ||||||
|         mut self, |         mut self, | ||||||
|         writer: impl FnMut(bool) -> Option<Box<dyn ErasedAssetWriter>> + Send + Sync + 'static, |         writer: impl FnMut(bool) -> Option<Box<dyn ErasedAssetWriter>> + Send + Sync + 'static, | ||||||
| @ -239,7 +236,7 @@ impl AssetSourceBuilder { | |||||||
|         self |         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( |     pub fn with_processed_reader( | ||||||
|         mut self, |         mut self, | ||||||
|         reader: impl FnMut() -> Box<dyn ErasedAssetReader> + Send + Sync + 'static, |         reader: impl FnMut() -> Box<dyn ErasedAssetReader> + Send + Sync + 'static, | ||||||
| @ -248,7 +245,7 @@ impl AssetSourceBuilder { | |||||||
|         self |         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( |     pub fn with_processed_writer( | ||||||
|         mut self, |         mut self, | ||||||
|         writer: impl FnMut(bool) -> Option<Box<dyn ErasedAssetWriter>> + Send + Sync + 'static, |         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.
 | /// for a given asset source.
 | ||||||
| #[derive(Resource, Default)] | #[derive(Resource, Default)] | ||||||
| pub struct AssetSourceBuilders { | 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`].
 | /// for a specific asset source, identified by an [`AssetSourceId`].
 | ||||||
| pub struct AssetSource { | pub struct AssetSource { | ||||||
|     id: AssetSourceId<'static>, |     id: AssetSourceId<'static>, | ||||||
| @ -397,13 +394,13 @@ impl AssetSource { | |||||||
|         self.id.clone() |         self.id.clone() | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /// Return's this source's unprocessed [`AssetReader`].
 |     /// Return's this source's unprocessed [`AssetReader`](crate::io::AssetReader).
 | ||||||
|     #[inline] |     #[inline] | ||||||
|     pub fn reader(&self) -> &dyn ErasedAssetReader { |     pub fn reader(&self) -> &dyn ErasedAssetReader { | ||||||
|         &*self.reader |         &*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] |     #[inline] | ||||||
|     pub fn writer(&self) -> Result<&dyn ErasedAssetWriter, MissingAssetWriterError> { |     pub fn writer(&self) -> Result<&dyn ErasedAssetWriter, MissingAssetWriterError> { | ||||||
|         self.writer |         self.writer | ||||||
| @ -411,7 +408,7 @@ impl AssetSource { | |||||||
|             .ok_or_else(|| MissingAssetWriterError(self.id.clone_owned())) |             .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] |     #[inline] | ||||||
|     pub fn processed_reader( |     pub fn processed_reader( | ||||||
|         &self, |         &self, | ||||||
| @ -421,7 +418,7 @@ impl AssetSource { | |||||||
|             .ok_or_else(|| MissingProcessedAssetReaderError(self.id.clone_owned())) |             .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] |     #[inline] | ||||||
|     pub fn processed_writer( |     pub fn processed_writer( | ||||||
|         &self, |         &self, | ||||||
| @ -451,7 +448,7 @@ impl AssetSource { | |||||||
|         self.processed_writer.is_some() |         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.
 |     /// the asset root.
 | ||||||
|     pub fn get_default_reader( |     pub fn get_default_reader( | ||||||
|         _path: String, |         _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.
 |     /// the asset root. This will return [`None`] if this platform does not support writing assets by default.
 | ||||||
|     pub fn get_default_writer( |     pub fn get_default_writer( | ||||||
|         _path: String, |         _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.
 |     /// the [`AssetProcessor`](crate::AssetProcessor) has finished processing the requested asset.
 | ||||||
|     pub fn gate_on_processor(&mut self, processor_data: Arc<AssetProcessorData>) { |     pub fn gate_on_processor(&mut self, processor_data: Arc<AssetProcessorData>) { | ||||||
|         if let Some(reader) = self.processed_reader.take() { |         if let Some(reader) = self.processed_reader.take() { | ||||||
| @ -619,7 +616,7 @@ impl AssetSources { | |||||||
|             .chain(Some(AssetSourceId::Default)) |             .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.
 |     /// the [`AssetProcessor`](crate::AssetProcessor) has finished processing the requested asset.
 | ||||||
|     pub fn gate_on_processor(&mut self, processor_data: Arc<AssetProcessorData>) { |     pub fn gate_on_processor(&mut self, processor_data: Arc<AssetProcessorData>) { | ||||||
|         for source in self.iter_processed_mut() { |         for source in self.iter_processed_mut() { | ||||||
| @ -633,17 +630,17 @@ impl AssetSources { | |||||||
| #[error("Asset Source '{0}' does not exist")] | #[error("Asset Source '{0}' does not exist")] | ||||||
| pub struct MissingAssetSourceError(AssetSourceId<'static>); | 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)] | #[derive(Error, Debug, Clone)] | ||||||
| #[error("Asset Source '{0}' does not have an AssetWriter.")] | #[error("Asset Source '{0}' does not have an AssetWriter.")] | ||||||
| pub struct MissingAssetWriterError(AssetSourceId<'static>); | 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)] | #[derive(Error, Debug, Clone, PartialEq, Eq)] | ||||||
| #[error("Asset Source '{0}' does not have a processed AssetReader.")] | #[error("Asset Source '{0}' does not have a processed AssetReader.")] | ||||||
| pub struct MissingProcessedAssetReaderError(AssetSourceId<'static>); | 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)] | #[derive(Error, Debug, Clone)] | ||||||
| #[error("Asset Source '{0}' does not have a processed AssetWriter.")] | #[error("Asset Source '{0}' does not have a processed AssetWriter.")] | ||||||
| pub struct MissingProcessedAssetWriterError(AssetSourceId<'static>); | pub struct MissingProcessedAssetWriterError(AssetSourceId<'static>); | ||||||
|  | |||||||
| @ -75,11 +75,7 @@ use std::{ | |||||||
| }; | }; | ||||||
| use thiserror::Error; | use thiserror::Error; | ||||||
| 
 | 
 | ||||||
| // Needed for doc strings
 | /// 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),
 | ||||||
| #[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),
 |  | ||||||
| /// processes them in some way, and writes them to a destination [`AssetSource`].
 | /// 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
 | /// 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:
 |     /// Processes all assets. This will:
 | ||||||
|     /// * For each "processed [`AssetSource`]:
 |     /// * For each "processed [`AssetSource`]:
 | ||||||
|     /// * Scan the [`ProcessorTransactionLog`] and recover from any failures detected
 |     /// * Scan the [`ProcessorTransactionLog`] and recover from any failures detected
 | ||||||
|     /// * Scan the processed [`AssetReader`] to build the current view of already processed assets.
 |     /// * Scan the processed [`AssetReader`](crate::io::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.
 |     /// * 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`], kick off a new "process job", which will process the asset
 |     /// * 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).
 |     ///     (if the latest version of the asset has not been processed).
 | ||||||
|     #[cfg(all(not(target_arch = "wasm32"), feature = "multi_threaded"))] |     #[cfg(all(not(target_arch = "wasm32"), feature = "multi_threaded"))] | ||||||
|     pub fn process_assets(&self) { |     pub fn process_assets(&self) { | ||||||
|  | |||||||
| @ -32,10 +32,7 @@ use std::{any::TypeId, path::Path, sync::Arc}; | |||||||
| use std::{future::Future, panic::AssertUnwindSafe}; | use std::{future::Future, panic::AssertUnwindSafe}; | ||||||
| use thiserror::Error; | use thiserror::Error; | ||||||
| 
 | 
 | ||||||
| #[allow(unused_imports, reason = "Needed for documentation links.")] | /// 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
 | ||||||
| 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
 |  | ||||||
| /// retrieve their current load states.
 | /// retrieve their current load states.
 | ||||||
| ///
 | ///
 | ||||||
| /// The general process to load an asset is:
 | /// The general process to load an asset is:
 | ||||||
| @ -75,7 +72,7 @@ pub enum AssetServerMode { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| impl AssetServer { | 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.
 |     /// asset sources and hot-reload them.
 | ||||||
|     pub fn new(sources: AssetSources, mode: AssetServerMode, watching_for_changes: bool) -> Self { |     pub fn new(sources: AssetSources, mode: AssetServerMode, watching_for_changes: bool) -> Self { | ||||||
|         Self::new_with_loaders( |         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.
 |     /// asset sources and hot-reload them.
 | ||||||
|     pub fn new_with_meta_check( |     pub fn new_with_meta_check( | ||||||
|         sources: AssetSources, |         sources: AssetSources, | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Shadowcat650
						Shadowcat650