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: Asset>(self) -> Handle<A>
pub fn typed_unchecked<A: Asset>(self) -> Handle<A>
Converts to a typed Handle. This will not check if the target Handle type matches.
sourcepub fn typed_debug_checked<A: Asset>(self) -> Handle<A>
pub fn typed_debug_checked<A: Asset>(self) -> Handle<A>
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: Asset>(self) -> Handle<A>
pub fn typed<A: Asset>(self) -> Handle<A>
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: Asset>(
self
) -> Result<Handle<A>, UntypedAssetConversionError>
pub fn try_typed<A: Asset>( self ) -> Result<Handle<A>, UntypedAssetConversionError>
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<&MetaTransform>
pub fn meta_transform(&self) -> Option<&MetaTransform>
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) -> Self
fn from(value: &UntypedHandle) -> Self
source§impl Hash for UntypedHandle
impl Hash for UntypedHandle
source§impl<A: Asset> PartialEq<Handle<A>> for UntypedHandle
impl<A: Asset> PartialEq<Handle<A>> for UntypedHandle
source§impl<A: Asset> PartialEq<UntypedHandle> for Handle<A>
impl<A: Asset> PartialEq<UntypedHandle> for Handle<A>
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§impl<A: Asset> PartialOrd<Handle<A>> for UntypedHandle
impl<A: Asset> PartialOrd<Handle<A>> for UntypedHandle
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: Asset> PartialOrd<UntypedHandle> for Handle<A>
impl<A: Asset> PartialOrd<UntypedHandle> for Handle<A>
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
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: Asset> TryFrom<UntypedHandle> for Handle<A>
impl<A: Asset> TryFrom<UntypedHandle> for Handle<A>
§type Error = UntypedAssetConversionError
type Error = UntypedAssetConversionError
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 Freeze for UntypedHandle
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> 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§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.