Enum bevy::asset::UntypedHandle
source · pub enum UntypedHandle {
Strong(Arc<StrongHandle>),
Weak(UntypedAssetId),
}
Expand description
Variants§
Strong(Arc<StrongHandle>)
Weak(UntypedAssetId)
Implementations§
source§impl UntypedHandle
impl UntypedHandle
sourcepub fn id(&self) -> UntypedAssetId
pub fn id(&self) -> UntypedAssetId
Returns the UntypedAssetId
for the referenced asset.
sourcepub fn path(&self) -> Option<&AssetPath<'static>>
pub fn path(&self) -> Option<&AssetPath<'static>>
Returns the path if this is (1) a strong handle and (2) the asset has a path
sourcepub fn clone_weak(&self) -> UntypedHandle
pub fn clone_weak(&self) -> UntypedHandle
Creates an UntypedHandle::Weak
clone of this UntypedHandle
, which will not keep the referenced Asset
alive.
sourcepub fn typed_unchecked<A>(self) -> Handle<A>where
A: Asset,
pub fn typed_unchecked<A>(self) -> Handle<A>where
A: Asset,
Converts to a typed Handle. This will not check if the target Handle type matches.
sourcepub fn typed_debug_checked<A>(self) -> Handle<A>where
A: Asset,
pub fn typed_debug_checked<A>(self) -> Handle<A>where
A: Asset,
Converts to a typed Handle. This will check the type when compiled with debug asserts, but it will not check if the target Handle type matches in release builds. Use this as an optimization when you want some degree of validation at dev-time, but you are also very certain that the type actually matches.
sourcepub fn typed<A>(self) -> Handle<A>where
A: Asset,
pub fn typed<A>(self) -> Handle<A>where
A: Asset,
Converts to a typed Handle. This will panic if the internal TypeId
does not match the given asset type A
sourcepub fn try_typed<A>(self) -> Result<Handle<A>, UntypedAssetConversionError>where
A: Asset,
pub fn try_typed<A>(self) -> Result<Handle<A>, UntypedAssetConversionError>where
A: Asset,
Converts to a typed Handle. This will panic if the internal TypeId
does not match the given asset type A
sourcepub fn meta_transform(
&self
) -> Option<&Box<dyn Fn(&mut (dyn AssetMetaDyn + 'static)) + Send + Sync>>
pub fn meta_transform( &self ) -> Option<&Box<dyn Fn(&mut (dyn AssetMetaDyn + 'static)) + Send + Sync>>
The “meta transform” for the strong handle. This will only be Some
if the handle is strong and there is a meta transform
associated with it.
Trait Implementations§
source§impl Clone for UntypedHandle
impl Clone for UntypedHandle
source§fn clone(&self) -> UntypedHandle
fn clone(&self) -> UntypedHandle
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for UntypedHandle
impl Debug for UntypedHandle
source§impl From<&UntypedHandle> for UntypedAssetId
impl From<&UntypedHandle> for UntypedAssetId
source§fn from(value: &UntypedHandle) -> UntypedAssetId
fn from(value: &UntypedHandle) -> UntypedAssetId
source§impl<A> From<Handle<A>> for UntypedHandlewhere
A: Asset,
impl<A> From<Handle<A>> for UntypedHandlewhere
A: Asset,
source§fn from(value: Handle<A>) -> UntypedHandle
fn from(value: Handle<A>) -> UntypedHandle
source§impl From<UntypedHandle> for UntypedAssetId
impl From<UntypedHandle> for UntypedAssetId
source§fn from(value: UntypedHandle) -> UntypedAssetId
fn from(value: UntypedHandle) -> UntypedAssetId
source§impl Hash for UntypedHandle
impl Hash for UntypedHandle
source§impl<A> PartialEq<Handle<A>> for UntypedHandlewhere
A: Asset,
impl<A> PartialEq<Handle<A>> for UntypedHandlewhere
A: Asset,
source§impl<A> PartialEq<UntypedHandle> for Handle<A>where
A: Asset,
impl<A> PartialEq<UntypedHandle> for Handle<A>where
A: Asset,
source§fn eq(&self, other: &UntypedHandle) -> bool
fn eq(&self, other: &UntypedHandle) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq for UntypedHandle
impl PartialEq for UntypedHandle
source§fn eq(&self, other: &UntypedHandle) -> bool
fn eq(&self, other: &UntypedHandle) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl<A> PartialOrd<Handle<A>> for UntypedHandlewhere
A: Asset,
impl<A> PartialOrd<Handle<A>> for UntypedHandlewhere
A: Asset,
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<A> PartialOrd<UntypedHandle> for Handle<A>where
A: Asset,
impl<A> PartialOrd<UntypedHandle> for Handle<A>where
A: Asset,
source§fn partial_cmp(&self, other: &UntypedHandle) -> Option<Ordering>
fn partial_cmp(&self, other: &UntypedHandle) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd for UntypedHandle
impl PartialOrd for UntypedHandle
source§fn partial_cmp(&self, other: &UntypedHandle) -> Option<Ordering>
fn partial_cmp(&self, other: &UntypedHandle) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<A> TryFrom<UntypedHandle> for Handle<A>where
A: Asset,
impl<A> TryFrom<UntypedHandle> for Handle<A>where
A: Asset,
§type Error = UntypedAssetConversionError
type Error = UntypedAssetConversionError
source§fn try_from(
value: UntypedHandle
) -> Result<Handle<A>, <Handle<A> as TryFrom<UntypedHandle>>::Error>
fn try_from( value: UntypedHandle ) -> Result<Handle<A>, <Handle<A> as TryFrom<UntypedHandle>>::Error>
source§impl VisitAssetDependencies for UntypedHandle
impl VisitAssetDependencies for UntypedHandle
fn visit_dependencies(&self, visit: &mut impl FnMut(UntypedAssetId))
impl Eq for UntypedHandle
Auto Trait Implementations§
impl !RefUnwindSafe for UntypedHandle
impl Send for UntypedHandle
impl Sync for UntypedHandle
impl Unpin for UntypedHandle
impl !UnwindSafe for UntypedHandle
Blanket Implementations§
source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
T
ShaderType
for self
. When used in AsBindGroup
derives, it is safe to assume that all images in self
exist.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
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.