Struct Ron
#[repr(transparent)]pub struct Ron<T>(pub T);Expand description
Loads a value from a JSON file.
This type can directly be used as a FileAsset to load values
from an AssetCache. This is useful to load assets external
types without a newtype wrapper (eg Vec).
Tuple Fields§
§0: TImplementations§
§impl<T> Ron<T>
impl<T> Ron<T>
pub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Unwraps the inner value.
Trait Implementations§
Source§impl<T: Concatenate> Concatenate for Ron<T>
impl<T: Concatenate> Concatenate for Ron<T>
fn concatenate(self, b: Self) -> Self
§impl<'de, T> Deserialize<'de> for Ron<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Ron<T>where
T: Deserialize<'de>,
§fn deserialize<D>(
deserializer: D,
) -> Result<Ron<T>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Ron<T>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl<T> FileAsset for Ron<T>
impl<T> FileAsset for Ron<T>
§const EXTENSIONS: &'static [&'static str]
const EXTENSIONS: &'static [&'static str]
This field enables you to specify multiple extension for an asset. Read more
§fn from_bytes(
bytes: Cow<'_, [u8]>,
) -> Result<Ron<T>, Box<dyn Error + Sync + Send>>
fn from_bytes( bytes: Cow<'_, [u8]>, ) -> Result<Ron<T>, Box<dyn Error + Sync + Send>>
Creates a value of this type from raw bytes.
§fn default_value(
id: &SharedString,
error: Box<dyn Error + Sync + Send>,
) -> Result<Self, Box<dyn Error + Sync + Send>>
fn default_value( id: &SharedString, error: Box<dyn Error + Sync + Send>, ) -> Result<Self, Box<dyn Error + Sync + Send>>
Specifies a eventual default value to use if an asset fails to load. If
this method returns
Ok, the returned value is used as an asset. In
particular, if this method always returns Ok, AssetCache::load is
guaranteed not to fail. Read more§const HOT_RELOADED: bool = true
const HOT_RELOADED: bool = true
If
false, disables hot-reloading of assets of this type (true by
default).§impl<T> Ord for Ron<T>where
T: Ord,
impl<T> Ord for Ron<T>where
T: Ord,
§impl<T> PartialOrd for Ron<T>where
T: PartialOrd,
impl<T> PartialOrd for Ron<T>where
T: PartialOrd,
§impl<T> Serialize for Ron<T>where
T: Serialize,
impl<T> Serialize for Ron<T>where
T: Serialize,
§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<T> Copy for Ron<T>where
T: Copy,
impl<T> Eq for Ron<T>where
T: Eq,
impl<T> StructuralPartialEq for Ron<T>
Auto Trait Implementations§
impl<T> Freeze for Ron<T>where
T: Freeze,
impl<T> RefUnwindSafe for Ron<T>where
T: RefUnwindSafe,
impl<T> Send for Ron<T>where
T: Send,
impl<T> Sync for Ron<T>where
T: Sync,
impl<T> Unpin for Ron<T>where
T: Unpin,
impl<T> UnwindSafe for Ron<T>where
T: UnwindSafe,
Blanket Implementations§
§impl<T> Asset for Twhere
T: Compound,
impl<T> Asset for Twhere
T: Compound,
§const HOT_RELOADED: bool = <T as Compound>::HOT_RELOADED
const HOT_RELOADED: bool = <T as Compound>::HOT_RELOADED
If
false, disable hot-reloading for assets of this type (true by
default). This avoids having to lock the asset to read it (ie it makes
[Handle::read] a noop)§fn load(
cache: &AssetCache,
id: &SharedString,
) -> Result<T, Box<dyn Error + Sync + Send>>
fn load( cache: &AssetCache, id: &SharedString, ) -> Result<T, Box<dyn Error + Sync + Send>>
Loads an asset from the cache. Read more
Source§impl<T> AssetCombined for Twhere
T: Asset + Concatenate,
impl<T> AssetCombined for Twhere
T: Asset + Concatenate,
fn load_and_combine( reloading_cache: &'static AssetCache, specifier: &str, ) -> Result<&'static Handle<T>, Error>
Source§fn load_and_combine_static(specifier: &str) -> Result<AssetHandle<Self>, Error>
fn load_and_combine_static(specifier: &str) -> Result<AssetHandle<Self>, Error>
Load combined table without hot-reload support
fn load_expect_combined( reloading_cache: &'static AssetCache, specifier: &str, ) -> AssetHandle<Self>
Source§fn load_expect_combined_static(specifier: &str) -> AssetHandle<Self>
fn load_expect_combined_static(specifier: &str) -> AssetHandle<Self>
Load combined table without hot-reload support, panic on error
Source§impl<T> AssetExt for Twhere
T: Asset,
impl<T> AssetExt for Twhere
T: Asset,
Source§fn load(specifier: &str) -> Result<&'static Handle<T>, Error>
fn load(specifier: &str) -> Result<&'static Handle<T>, Error>
Function used to load assets from the filesystem or the cache.
Example usage: Read more
fn load_owned(specifier: &str) -> Result<T, Error>
fn get_or_insert(specifier: &str, default: T) -> &'static Handle<T>
Source§fn load_cloned(specifier: &str) -> Result<Self, Error>where
Self: Clone,
fn load_cloned(specifier: &str) -> Result<Self, Error>where
Self: Clone,
Function used to load assets from the filesystem or the cache and return
a clone.
fn load_or_insert_with( specifier: &str, default: impl FnOnce(Error) -> Self, ) -> AssetHandle<Self>
Source§fn load_expect(specifier: &str) -> AssetHandle<Self>
fn load_expect(specifier: &str) -> AssetHandle<Self>
Function used to load essential assets from the filesystem or the cache.
It will panic if the asset is not found. Example usage: Read more
Source§fn load_expect_cloned(specifier: &str) -> Selfwhere
Self: Clone,
fn load_expect_cloned(specifier: &str) -> Selfwhere
Self: Clone,
Function used to load essential assets from the filesystem or the cache
and return a clone. It will panic if the asset is not found.
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<T> Compound for Twhere
T: FileAsset,
impl<T> Compound for Twhere
T: FileAsset,
§const HOT_RELOADED: bool = Self::HOT_RELOADED
const HOT_RELOADED: bool = Self::HOT_RELOADED
👎Deprecated: Use
Asset insteadIf
false, disable hot-reloading for assets of this type (true by
default). This avoids having to lock the asset to read it (ie it makes
[Handle::read] a noop)§fn load(
cache: &AssetCache,
id: &SharedString,
) -> Result<T, Box<dyn Error + Sync + Send>>
fn load( cache: &AssetCache, id: &SharedString, ) -> Result<T, Box<dyn Error + Sync + Send>>
👎Deprecated: Use
Asset insteadLoads an asset from the cache.
§impl<T> DirLoadable for Twhere
T: FileAsset,
impl<T> DirLoadable for Twhere
T: FileAsset,
§fn select_ids(
cache: &AssetCache,
id: &SharedString,
) -> Result<Vec<SharedString>, Error>
fn select_ids( cache: &AssetCache, id: &SharedString, ) -> Result<Vec<SharedString>, Error>
Returns the ids of the assets contained in the directory given by
id. Read more§fn sub_directories(
cache: &AssetCache,
id: &SharedString,
f: impl FnMut(&str),
) -> Result<(), Error>
fn sub_directories( cache: &AssetCache, id: &SharedString, f: impl FnMut(&str), ) -> Result<(), Error>
Executes the given closure for each id of a child directory of the given
directory. The default implementation reads the cache’s source.
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more