@@ -72,6 +72,10 @@ impl From<std::io::Error> for AssetReaderError {
7272 }
7373}
7474
75+ #[ diagnostic:: on_unimplemented(
76+ message = "`{Self}` is not an asynchronous and seekable reader" ,
77+ label = "invalid reader"
78+ ) ]
7579pub trait AsyncReadAndSeek : AsyncRead + AsyncSeek { }
7680
7781impl < T : AsyncRead + AsyncSeek > AsyncReadAndSeek for T { }
@@ -83,6 +87,10 @@ pub type Reader<'a> = dyn AsyncReadAndSeek + Unpin + Send + Sync + 'a;
8387/// `path`. This trait is not object safe, if needed use a dyn [`ErasedAssetReader`] instead.
8488///
8589/// Also see [`AssetWriter`].
90+ #[ diagnostic:: on_unimplemented(
91+ message = "`{Self}` is not an asset reader" ,
92+ label = "invalid asset reader"
93+ ) ]
8694pub trait AssetReader : Send + Sync + ' static {
8795 /// Returns a future to load the full file data at the provided path.
8896 fn read < ' a > (
@@ -121,6 +129,10 @@ pub trait AssetReader: Send + Sync + 'static {
121129
122130/// Equivalent to an [`AssetReader`] but using boxed futures, necessary eg. when using a `dyn AssetReader`,
123131/// as [`AssetReader`] isn't currently object safe.
132+ #[ diagnostic:: on_unimplemented(
133+ message = "`{Self}` is not an erasable asset reader" ,
134+ label = "invalid asset reader"
135+ ) ]
124136pub trait ErasedAssetReader : Send + Sync + ' static {
125137 /// Returns a future to load the full file data at the provided path.
126138 fn read < ' a > ( & ' a self , path : & ' a Path )
@@ -192,6 +204,10 @@ pub enum AssetWriterError {
192204/// `path`. This trait is not object safe, if needed use a dyn [`ErasedAssetWriter`] instead.
193205///
194206/// Also see [`AssetReader`].
207+ #[ diagnostic:: on_unimplemented(
208+ message = "`{Self}` is not an asset writer" ,
209+ label = "invalid asset writer"
210+ ) ]
195211pub trait AssetWriter : Send + Sync + ' static {
196212 /// Writes the full asset bytes at the provided path.
197213 fn write < ' a > (
@@ -274,6 +290,10 @@ pub trait AssetWriter: Send + Sync + 'static {
274290
275291/// Equivalent to an [`AssetWriter`] but using boxed futures, necessary eg. when using a `dyn AssetWriter`,
276292/// as [`AssetWriter`] isn't currently object safe.
293+ #[ diagnostic:: on_unimplemented(
294+ message = "`{Self}` is not an erasable asset writer" ,
295+ label = "invalid asset writer"
296+ ) ]
277297pub trait ErasedAssetWriter : Send + Sync + ' static {
278298 /// Writes the full asset bytes at the provided path.
279299 fn write < ' a > ( & ' a self , path : & ' a Path ) -> BoxedFuture < Result < Box < Writer > , AssetWriterError > > ;
@@ -429,6 +449,10 @@ pub enum AssetSourceEvent {
429449
430450/// A handle to an "asset watcher" process, that will listen for and emit [`AssetSourceEvent`] values for as long as
431451/// [`AssetWatcher`] has not been dropped.
452+ #[ diagnostic:: on_unimplemented(
453+ message = "`{Self}` is not an asset watcher" ,
454+ label = "invalid asset watcher"
455+ ) ]
432456pub trait AssetWatcher : Send + Sync + ' static { }
433457
434458/// An [`AsyncRead`] implementation capable of reading a [`Vec<u8>`].
0 commit comments