pub enum Handle<A>where
A: Asset,{
Strong(Arc<StrongHandle>),
Weak(AssetId<A>),
}
Expand description
A strong or weak handle to a specific Asset
. If a Handle
is Handle::Strong
, the Asset
will be kept
alive until the Handle
is dropped. If a Handle
is Handle::Weak
, it does not necessarily reference a live Asset
,
nor will it keep assets alive.
Handle
can be cloned. If a Handle::Strong
is cloned, the referenced Asset
will not be freed until all instances
of the Handle
are dropped.
Handle::Strong
also provides access to useful Asset
metadata, such as the AssetPath
(if it exists).
Variants§
Strong(Arc<StrongHandle>)
A “strong” reference to a live (or loading) Asset
. If a Handle
is Handle::Strong
, the Asset
will be kept
alive until the Handle
is dropped. Strong handles also provide access to additional asset metadata.
Weak(AssetId<A>)
A “weak” reference to an Asset
. If a Handle
is Handle::Weak
, it does not necessarily reference a live Asset
,
nor will it keep assets alive.
Implementations§
§impl<A> Handle<A>where
A: Asset,
impl<A> Handle<A>where
A: Asset,
pub const fn weak_from_u128(value: u128) -> Handle<A>
pub const fn weak_from_u128(value: u128) -> Handle<A>
Create a new Handle::Weak
with the given u128
encoding of a Uuid
.
pub fn id(&self) -> AssetId<A>
pub fn id(&self) -> AssetId<A>
Examples found in repository?
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350
fn resize_image(
image_mesh: Query<(&Handle<StandardMaterial>, &Handle<Mesh>), With<HDRViewer>>,
materials: Res<Assets<StandardMaterial>>,
mut meshes: ResMut<Assets<Mesh>>,
images: Res<Assets<Image>>,
mut image_events: EventReader<AssetEvent<Image>>,
) {
for event in image_events.read() {
let (AssetEvent::Added { id } | AssetEvent::Modified { id }) = event else {
continue;
};
for (mat_h, mesh_h) in &image_mesh {
let Some(mat) = materials.get(mat_h) else {
continue;
};
let Some(ref base_color_texture) = mat.base_color_texture else {
continue;
};
if *id != base_color_texture.id() {
continue;
};
let Some(image_changed) = images.get(*id) else {
continue;
};
let size = image_changed.size_f32().normalize_or_zero() * 1.4;
// Resize Mesh
let quad = Mesh::from(Rectangle::from_size(size));
meshes.insert(mesh_h, quad);
}
}
}
More examples
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
fn create_array_texture(
mut commands: Commands,
asset_server: Res<AssetServer>,
mut loading_texture: ResMut<LoadingTexture>,
mut images: ResMut<Assets<Image>>,
mut meshes: ResMut<Assets<Mesh>>,
mut materials: ResMut<Assets<ArrayTextureMaterial>>,
) {
if loading_texture.is_loaded
|| asset_server.load_state(loading_texture.handle.id()) != LoadState::Loaded
{
return;
}
loading_texture.is_loaded = true;
let image = images.get_mut(&loading_texture.handle).unwrap();
// Create a new array texture asset from the loaded texture.
let array_layers = 4;
image.reinterpret_stacked_2d_as_array(array_layers);
// Spawn some cubes using the array texture
let mesh_handle = meshes.add(Cuboid::default());
let material_handle = materials.add(ArrayTextureMaterial {
array_texture: loading_texture.handle.clone(),
});
for x in -5..=5 {
commands.spawn(MaterialMeshBundle {
mesh: mesh_handle.clone(),
material: material_handle.clone(),
transform: Transform::from_xyz(x as f32 + 0.5, 0.0, 0.0),
..Default::default()
});
}
}
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342
pub fn extract_colored_mesh2d(
mut commands: Commands,
mut previous_len: Local<usize>,
// When extracting, you must use `Extract` to mark the `SystemParam`s
// which should be taken from the main world.
query: Extract<
Query<(Entity, &ViewVisibility, &GlobalTransform, &Mesh2dHandle), With<ColoredMesh2d>>,
>,
mut render_mesh_instances: ResMut<RenderColoredMesh2dInstances>,
) {
let mut values = Vec::with_capacity(*previous_len);
for (entity, view_visibility, transform, handle) in &query {
if !view_visibility.get() {
continue;
}
let transforms = Mesh2dTransforms {
transform: (&transform.affine()).into(),
flags: MeshFlags::empty().bits(),
};
values.push((entity, ColoredMesh2d));
render_mesh_instances.insert(
entity,
RenderMesh2dInstance {
mesh_asset_id: handle.0.id(),
transforms,
material_bind_group_id: Material2dBindGroupId::default(),
automatic_batching: false,
},
);
}
*previous_len = values.len();
commands.insert_or_spawn_batch(values);
}
pub 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
pub fn clone_weak(&self) -> Handle<A>
pub fn clone_weak(&self) -> Handle<A>
Creates a Handle::Weak
clone of this Handle
, which will not keep the referenced Asset
alive.
Examples found in repository?
More examples
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
fn scene_load_check(
asset_server: Res<AssetServer>,
mut scenes: ResMut<Assets<Scene>>,
gltf_assets: Res<Assets<Gltf>>,
mut scene_handle: ResMut<SceneHandle>,
mut scene_spawner: ResMut<SceneSpawner>,
) {
match scene_handle.instance_id {
None => {
if asset_server.load_state(&scene_handle.gltf_handle) == LoadState::Loaded {
let gltf = gltf_assets.get(&scene_handle.gltf_handle).unwrap();
if gltf.scenes.len() > 1 {
info!(
"Displaying scene {} out of {}",
scene_handle.scene_index,
gltf.scenes.len()
);
info!("You can select the scene by adding '#Scene' followed by a number to the end of the file path (e.g '#Scene1' to load the second scene).");
}
let gltf_scene_handle =
gltf.scenes
.get(scene_handle.scene_index)
.unwrap_or_else(|| {
panic!(
"glTF file doesn't contain scene {}!",
scene_handle.scene_index
)
});
let scene = scenes.get_mut(gltf_scene_handle).unwrap();
let mut query = scene
.world
.query::<(Option<&DirectionalLight>, Option<&PointLight>)>();
scene_handle.has_light =
query
.iter(&scene.world)
.any(|(maybe_directional_light, maybe_point_light)| {
maybe_directional_light.is_some() || maybe_point_light.is_some()
});
scene_handle.instance_id =
Some(scene_spawner.spawn(gltf_scene_handle.clone_weak()));
info!("Spawning scene...");
}
}
Some(instance_id) if !scene_handle.is_loaded => {
if scene_spawner.instance_is_ready(instance_id) {
info!("...done!");
scene_handle.is_loaded = true;
}
}
Some(_) => {}
}
}
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
fn setup_scene(mut commands: Commands, asset_server: Res<AssetServer>) {
commands.spawn(Camera2dBundle::default());
let font = asset_server.load("fonts/FiraMono-Medium.ttf");
commands.spawn(
TextBundle::from_sections([
TextSection {
value: "IME Enabled: ".to_string(),
style: TextStyle {
font: font.clone_weak(),
font_size: 20.0,
..default()
},
},
TextSection {
value: "false\n".to_string(),
style: TextStyle {
font: font.clone_weak(),
font_size: 30.0,
..default()
},
},
TextSection {
value: "IME Active: ".to_string(),
style: TextStyle {
font: font.clone_weak(),
font_size: 20.0,
..default()
},
},
TextSection {
value: "false\n".to_string(),
style: TextStyle {
font: font.clone_weak(),
font_size: 30.0,
..default()
},
},
TextSection {
value: "click to toggle IME, press return to start a new line\n\n".to_string(),
style: TextStyle {
font: font.clone_weak(),
font_size: 18.0,
..default()
},
},
TextSection {
value: "".to_string(),
style: TextStyle {
font,
font_size: 25.0,
..default()
},
},
])
.with_style(Style {
position_type: PositionType::Absolute,
top: Val::Px(10.0),
left: Val::Px(10.0),
..default()
}),
);
commands.spawn(Text2dBundle {
text: Text::from_section(
"".to_string(),
TextStyle {
font: asset_server.load("fonts/FiraMono-Medium.ttf"),
font_size: 100.0,
..default()
},
),
..default()
});
}
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337
fn setup(
mut commands: Commands,
mut materials: ResMut<Assets<StandardMaterial>>,
mut meshes: ResMut<Assets<Mesh>>,
mut normal: ResMut<Normal>,
asset_server: Res<AssetServer>,
) {
// The normal map. Note that to generate it in the GIMP image editor, you should
// open the depth map, and do Filters → Generic → Normal Map
// You should enable the "flip X" checkbox.
let normal_handle = asset_server.load("textures/parallax_example/cube_normal.png");
normal.0 = Some(normal_handle);
// Camera
commands.spawn((
Camera3dBundle {
transform: Transform::from_xyz(1.5, 1.5, 1.5).looking_at(Vec3::ZERO, Vec3::Y),
..default()
},
CameraController,
));
// light
commands
.spawn(PointLightBundle {
transform: Transform::from_xyz(2.0, 1.0, -1.1),
point_light: PointLight {
shadows_enabled: true,
..default()
},
..default()
})
.with_children(|commands| {
// represent the light source as a sphere
let mesh = meshes.add(Sphere::new(0.05).mesh().ico(3).unwrap());
commands.spawn(PbrBundle { mesh, ..default() });
});
// Plane
commands.spawn(PbrBundle {
mesh: meshes.add(Plane3d::default().mesh().size(10.0, 10.0)),
material: materials.add(StandardMaterial {
// standard material derived from dark green, but
// with roughness and reflectance set.
perceptual_roughness: 0.45,
reflectance: 0.18,
..Color::srgb_u8(0, 80, 0).into()
}),
transform: Transform::from_xyz(0.0, -1.0, 0.0),
..default()
});
let parallax_depth_scale = TargetDepth::default().0;
let max_parallax_layer_count = TargetLayers::default().0.exp2();
let parallax_mapping_method = CurrentMethod::default();
let parallax_material = materials.add(StandardMaterial {
perceptual_roughness: 0.4,
base_color_texture: Some(asset_server.load("textures/parallax_example/cube_color.png")),
normal_map_texture: normal.0.clone(),
// The depth map is a greyscale texture where black is the highest level and
// white the lowest.
depth_map: Some(asset_server.load("textures/parallax_example/cube_depth.png")),
parallax_depth_scale,
parallax_mapping_method: parallax_mapping_method.0,
max_parallax_layer_count,
..default()
});
commands.spawn((
PbrBundle {
mesh: meshes.add(
// NOTE: for normal maps and depth maps to work, the mesh
// needs tangents generated.
Mesh::from(Cuboid::default())
.with_generated_tangents()
.unwrap(),
),
material: parallax_material.clone_weak(),
..default()
},
Spin { speed: 0.3 },
));
let background_cube = meshes.add(
Mesh::from(Cuboid::new(40.0, 40.0, 40.0))
.with_generated_tangents()
.unwrap(),
);
let background_cube_bundle = |translation| {
(
PbrBundle {
transform: Transform::from_translation(translation),
mesh: background_cube.clone(),
material: parallax_material.clone(),
..default()
},
Spin { speed: -0.1 },
)
};
commands.spawn(background_cube_bundle(Vec3::new(45., 0., 0.)));
commands.spawn(background_cube_bundle(Vec3::new(-45., 0., 0.)));
commands.spawn(background_cube_bundle(Vec3::new(0., 0., 45.)));
commands.spawn(background_cube_bundle(Vec3::new(0., 0., -45.)));
let style = TextStyle {
font_size: 20.0,
..default()
};
// example instructions
commands.spawn(
TextBundle::from_sections(vec![
TextSection::new(
format!("Parallax depth scale: {parallax_depth_scale:.5}\n"),
style.clone(),
),
TextSection::new(
format!("Layers: {max_parallax_layer_count:.0}\n"),
style.clone(),
),
TextSection::new(format!("{parallax_mapping_method}\n"), style.clone()),
TextSection::new("\n\n", style.clone()),
TextSection::new("Controls:\n", style.clone()),
TextSection::new("Left click - Change view angle\n", style.clone()),
TextSection::new(
"1/2 - Decrease/Increase parallax depth scale\n",
style.clone(),
),
TextSection::new("3/4 - Decrease/Increase layer count\n", style.clone()),
TextSection::new("Space - Switch parallaxing algorithm\n", style),
])
.with_style(Style {
position_type: PositionType::Absolute,
top: Val::Px(12.0),
left: Val::Px(12.0),
..default()
}),
);
}
pub fn untyped(self) -> UntypedHandle
pub fn untyped(self) -> UntypedHandle
Converts this Handle
to an “untyped” / “generic-less” UntypedHandle
, which stores the Asset
type information
inside UntypedHandle
. This will return UntypedHandle::Strong
for Handle::Strong
and UntypedHandle::Weak
for
Handle::Weak
.
Trait Implementations§
§impl<A> Component for Handle<A>
impl<A> Component for Handle<A>
§const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::Table
const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::Table
§fn register_component_hooks(_hooks: &mut ComponentHooks)
fn register_component_hooks(_hooks: &mut ComponentHooks)
ComponentHooks
.§impl<A> Enum for Handle<A>where
A: Asset + TypePath,
Handle<A>: Any + Send + Sync,
Arc<StrongHandle>: FromReflect + TypePath + RegisterForReflection,
AssetId<A>: FromReflect + TypePath + RegisterForReflection,
impl<A> Enum for Handle<A>where
A: Asset + TypePath,
Handle<A>: Any + Send + Sync,
Arc<StrongHandle>: FromReflect + TypePath + RegisterForReflection,
AssetId<A>: FromReflect + TypePath + RegisterForReflection,
§fn field(&self, __name_param: &str) -> Option<&(dyn Reflect + 'static)>
fn field(&self, __name_param: &str) -> Option<&(dyn Reflect + 'static)>
§fn field_at(&self, __index_param: usize) -> Option<&(dyn Reflect + 'static)>
fn field_at(&self, __index_param: usize) -> Option<&(dyn Reflect + 'static)>
§fn field_mut(
&mut self,
__name_param: &str
) -> Option<&mut (dyn Reflect + 'static)>
fn field_mut( &mut self, __name_param: &str ) -> Option<&mut (dyn Reflect + 'static)>
§fn field_at_mut(
&mut self,
__index_param: usize
) -> Option<&mut (dyn Reflect + 'static)>
fn field_at_mut( &mut self, __index_param: usize ) -> Option<&mut (dyn Reflect + 'static)>
§fn index_of(&self, __name_param: &str) -> Option<usize>
fn index_of(&self, __name_param: &str) -> Option<usize>
§fn name_at(&self, __index_param: usize) -> Option<&str>
fn name_at(&self, __index_param: usize) -> Option<&str>
§fn iter_fields(&self) -> VariantFieldIter<'_> ⓘ
fn iter_fields(&self) -> VariantFieldIter<'_> ⓘ
§fn variant_name(&self) -> &str
fn variant_name(&self) -> &str
§fn variant_index(&self) -> usize
fn variant_index(&self) -> usize
§fn variant_type(&self) -> VariantType
fn variant_type(&self) -> VariantType
fn clone_dynamic(&self) -> DynamicEnum
§fn is_variant(&self, variant_type: VariantType) -> bool
fn is_variant(&self, variant_type: VariantType) -> bool
§fn variant_path(&self) -> String
fn variant_path(&self) -> String
§impl<T> ExtractComponent for Handle<T>where
T: Asset,
impl<T> ExtractComponent for Handle<T>where
T: Asset,
§type QueryData = &'static Handle<T>
type QueryData = &'static Handle<T>
ReadOnlyQueryData
to fetch the components to extract.§type QueryFilter = ()
type QueryFilter = ()
§fn extract_component(
handle: <<Handle<T> as ExtractComponent>::QueryData as WorldQuery>::Item<'_>
) -> Option<<Handle<T> as ExtractComponent>::Out>
fn extract_component( handle: <<Handle<T> as ExtractComponent>::QueryData as WorldQuery>::Item<'_> ) -> Option<<Handle<T> as ExtractComponent>::Out>
§impl<A> From<&Handle<A>> for UntypedAssetIdwhere
A: Asset,
impl<A> From<&Handle<A>> for UntypedAssetIdwhere
A: Asset,
§fn from(value: &Handle<A>) -> UntypedAssetId
fn from(value: &Handle<A>) -> UntypedAssetId
§impl<A> From<&mut Handle<A>> for UntypedAssetIdwhere
A: Asset,
impl<A> From<&mut Handle<A>> for UntypedAssetIdwhere
A: Asset,
§fn from(value: &mut Handle<A>) -> UntypedAssetId
fn from(value: &mut Handle<A>) -> UntypedAssetId
§impl<A> From<Handle<A>> for UntypedHandlewhere
A: Asset,
impl<A> From<Handle<A>> for UntypedHandlewhere
A: Asset,
§fn from(value: Handle<A>) -> UntypedHandle
fn from(value: Handle<A>) -> UntypedHandle
§impl From<Handle<Image>> for ColorMaterial
impl From<Handle<Image>> for ColorMaterial
§fn from(texture: Handle<Image>) -> ColorMaterial
fn from(texture: Handle<Image>) -> ColorMaterial
§impl From<Handle<Image>> for RenderTarget
impl From<Handle<Image>> for RenderTarget
§fn from(handle: Handle<Image>) -> RenderTarget
fn from(handle: Handle<Image>) -> RenderTarget
§impl From<Handle<Image>> for StandardMaterial
impl From<Handle<Image>> for StandardMaterial
§fn from(texture: Handle<Image>) -> StandardMaterial
fn from(texture: Handle<Image>) -> StandardMaterial
§impl From<Handle<Mesh>> for Mesh2dHandle
impl From<Handle<Mesh>> for Mesh2dHandle
§fn from(handle: Handle<Mesh>) -> Mesh2dHandle
fn from(handle: Handle<Mesh>) -> Mesh2dHandle
§impl From<Handle<TextureAtlasLayout>> for TextureAtlas
impl From<Handle<TextureAtlasLayout>> for TextureAtlas
§fn from(texture_atlas: Handle<TextureAtlasLayout>) -> TextureAtlas
fn from(texture_atlas: Handle<TextureAtlasLayout>) -> TextureAtlas
§impl<A> FromReflect for Handle<A>where
A: Asset + TypePath,
Handle<A>: Any + Send + Sync,
Arc<StrongHandle>: FromReflect + TypePath + RegisterForReflection,
AssetId<A>: FromReflect + TypePath + RegisterForReflection,
impl<A> FromReflect for Handle<A>where
A: Asset + TypePath,
Handle<A>: Any + Send + Sync,
Arc<StrongHandle>: FromReflect + TypePath + RegisterForReflection,
AssetId<A>: FromReflect + TypePath + RegisterForReflection,
§fn from_reflect(__param0: &(dyn Reflect + 'static)) -> Option<Handle<A>>
fn from_reflect(__param0: &(dyn Reflect + 'static)) -> Option<Handle<A>>
Self
from a reflected value.§fn take_from_reflect(
reflect: Box<dyn Reflect>
) -> Result<Self, Box<dyn Reflect>>
fn take_from_reflect( reflect: Box<dyn Reflect> ) -> Result<Self, Box<dyn Reflect>>
Self
using,
constructing the value using from_reflect
if that fails. Read more§impl<A> FromType<Handle<A>> for ReflectHandlewhere
A: Asset,
impl<A> FromType<Handle<A>> for ReflectHandlewhere
A: Asset,
fn from_type() -> ReflectHandle
§impl<A> GetTypeRegistration for Handle<A>where
A: Asset + TypePath,
Handle<A>: Any + Send + Sync,
Arc<StrongHandle>: FromReflect + TypePath + RegisterForReflection,
AssetId<A>: FromReflect + TypePath + RegisterForReflection,
impl<A> GetTypeRegistration for Handle<A>where
A: Asset + TypePath,
Handle<A>: Any + Send + Sync,
Arc<StrongHandle>: FromReflect + TypePath + RegisterForReflection,
AssetId<A>: FromReflect + TypePath + RegisterForReflection,
§fn get_type_registration() -> TypeRegistration
fn get_type_registration() -> TypeRegistration
TypeRegistration
for this type.§fn register_type_dependencies(registry: &mut TypeRegistry)
fn register_type_dependencies(registry: &mut TypeRegistry)
§impl<A> Ord for Handle<A>where
A: Asset,
impl<A> Ord for Handle<A>where
A: Asset,
§impl<A> PartialEq<Handle<A>> for UntypedHandlewhere
A: Asset,
impl<A> PartialEq<Handle<A>> for UntypedHandlewhere
A: Asset,
§impl<A> PartialEq<UntypedHandle> for Handle<A>where
A: Asset,
impl<A> PartialEq<UntypedHandle> for Handle<A>where
A: Asset,
§fn eq(&self, other: &UntypedHandle) -> bool
fn eq(&self, other: &UntypedHandle) -> bool
self
and other
values to be equal, and is used
by ==
.§impl<A> PartialOrd<Handle<A>> for UntypedHandlewhere
A: Asset,
impl<A> PartialOrd<Handle<A>> for UntypedHandlewhere
A: Asset,
§fn partial_cmp(&self, other: &Handle<A>) -> Option<Ordering>
fn partial_cmp(&self, other: &Handle<A>) -> 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 more§impl<A> PartialOrd<UntypedHandle> for Handle<A>where
A: Asset,
impl<A> PartialOrd<UntypedHandle> for Handle<A>where
A: Asset,
§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 more§impl<A> PartialOrd for Handle<A>where
A: Asset,
impl<A> PartialOrd for Handle<A>where
A: Asset,
§fn partial_cmp(&self, other: &Handle<A>) -> Option<Ordering>
fn partial_cmp(&self, other: &Handle<A>) -> 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 more§impl<A> Reflect for Handle<A>where
A: Asset + TypePath,
Handle<A>: Any + Send + Sync,
Arc<StrongHandle>: FromReflect + TypePath + RegisterForReflection,
AssetId<A>: FromReflect + TypePath + RegisterForReflection,
impl<A> Reflect for Handle<A>where
A: Asset + TypePath,
Handle<A>: Any + Send + Sync,
Arc<StrongHandle>: FromReflect + TypePath + RegisterForReflection,
AssetId<A>: FromReflect + TypePath + RegisterForReflection,
§fn get_represented_type_info(&self) -> Option<&'static TypeInfo>
fn get_represented_type_info(&self) -> Option<&'static TypeInfo>
§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut dyn Any
.§fn into_reflect(self: Box<Handle<A>>) -> Box<dyn Reflect>
fn into_reflect(self: Box<Handle<A>>) -> Box<dyn Reflect>
§fn as_reflect(&self) -> &(dyn Reflect + 'static)
fn as_reflect(&self) -> &(dyn Reflect + 'static)
§fn as_reflect_mut(&mut self) -> &mut (dyn Reflect + 'static)
fn as_reflect_mut(&mut self) -> &mut (dyn Reflect + 'static)
§fn clone_value(&self) -> Box<dyn Reflect>
fn clone_value(&self) -> Box<dyn Reflect>
Reflect
trait object. Read more§fn set(
&mut self,
__value_param: Box<dyn Reflect>
) -> Result<(), Box<dyn Reflect>>
fn set( &mut self, __value_param: Box<dyn Reflect> ) -> Result<(), Box<dyn Reflect>>
§fn apply(&mut self, __value_param: &(dyn Reflect + 'static))
fn apply(&mut self, __value_param: &(dyn Reflect + 'static))
§fn reflect_kind(&self) -> ReflectKind
fn reflect_kind(&self) -> ReflectKind
§fn reflect_ref(&self) -> ReflectRef<'_>
fn reflect_ref(&self) -> ReflectRef<'_>
§fn reflect_mut(&mut self) -> ReflectMut<'_>
fn reflect_mut(&mut self) -> ReflectMut<'_>
§fn reflect_owned(self: Box<Handle<A>>) -> ReflectOwned
fn reflect_owned(self: Box<Handle<A>>) -> ReflectOwned
§fn reflect_hash(&self) -> Option<u64>
fn reflect_hash(&self) -> Option<u64>
§fn reflect_partial_eq(&self, value: &(dyn Reflect + 'static)) -> Option<bool>
fn reflect_partial_eq(&self, value: &(dyn Reflect + 'static)) -> Option<bool>
§fn debug(&self, f: &mut Formatter<'_>) -> Result<(), Error>
fn debug(&self, f: &mut Formatter<'_>) -> Result<(), Error>
§fn serializable(&self) -> Option<Serializable<'_>>
fn serializable(&self) -> Option<Serializable<'_>>
§fn is_dynamic(&self) -> bool
fn is_dynamic(&self) -> bool
§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
§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>
§impl<A> TypePath for Handle<A>
impl<A> TypePath for Handle<A>
§fn short_type_path() -> &'static str
fn short_type_path() -> &'static str
§fn type_ident() -> Option<&'static str>
fn type_ident() -> Option<&'static str>
§fn crate_name() -> Option<&'static str>
fn crate_name() -> Option<&'static str>
§impl<A> Typed for Handle<A>where
A: Asset + TypePath,
Handle<A>: Any + Send + Sync,
Arc<StrongHandle>: FromReflect + TypePath + RegisterForReflection,
AssetId<A>: FromReflect + TypePath + RegisterForReflection,
impl<A> Typed for Handle<A>where
A: Asset + TypePath,
Handle<A>: Any + Send + Sync,
Arc<StrongHandle>: FromReflect + TypePath + RegisterForReflection,
AssetId<A>: FromReflect + TypePath + RegisterForReflection,
§impl<A> VisitAssetDependencies for Handle<A>where
A: Asset,
impl<A> VisitAssetDependencies for Handle<A>where
A: Asset,
fn visit_dependencies(&self, visit: &mut impl FnMut(UntypedAssetId))
impl<A> Eq for Handle<A>where
A: Asset,
Auto Trait Implementations§
impl<A> Freeze for Handle<A>
impl<A> !RefUnwindSafe for Handle<A>
impl<A> Send for Handle<A>
impl<A> Sync for Handle<A>
impl<A> Unpin for Handle<A>
impl<A> !UnwindSafe for Handle<A>
Blanket Implementations§
§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> 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
§impl<C> Bundle for Cwhere
C: Component,
impl<C> Bundle for Cwhere
C: Component,
fn component_ids( components: &mut Components, storages: &mut Storages, ids: &mut impl FnMut(ComponentId) )
unsafe fn from_components<T, F>(ctx: &mut T, func: &mut F) -> C
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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
.§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
.§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.§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.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<C> DynamicBundle for Cwhere
C: Component,
impl<C> DynamicBundle for Cwhere
C: Component,
fn get_components(self, func: &mut impl FnMut(StorageType, OwningPtr<'_>))
§impl<T> DynamicTypePath for Twhere
T: TypePath,
impl<T> DynamicTypePath for Twhere
T: TypePath,
§fn reflect_type_path(&self) -> &str
fn reflect_type_path(&self) -> &str
TypePath::type_path
.§fn reflect_short_type_path(&self) -> &str
fn reflect_short_type_path(&self) -> &str
§fn reflect_type_ident(&self) -> Option<&str>
fn reflect_type_ident(&self) -> Option<&str>
TypePath::type_ident
.§fn reflect_crate_name(&self) -> Option<&str>
fn reflect_crate_name(&self) -> Option<&str>
TypePath::crate_name
.§fn reflect_module_path(&self) -> Option<&str>
fn reflect_module_path(&self) -> Option<&str>
§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
§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
key
and return true
if they are equal.§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Self
using data from the given World
.§impl<T> GetPath for T
impl<T> GetPath for T
§fn reflect_path<'p>(
&self,
path: impl ReflectPath<'p>
) -> Result<&(dyn Reflect + 'static), ReflectPathError<'p>>
fn reflect_path<'p>( &self, path: impl ReflectPath<'p> ) -> Result<&(dyn Reflect + 'static), ReflectPathError<'p>>
path
. Read more§fn reflect_path_mut<'p>(
&mut self,
path: impl ReflectPath<'p>
) -> Result<&mut (dyn Reflect + 'static), ReflectPathError<'p>>
fn reflect_path_mut<'p>( &mut self, path: impl ReflectPath<'p> ) -> Result<&mut (dyn Reflect + 'static), ReflectPathError<'p>>
path
. Read more§fn path<'p, T>(
&self,
path: impl ReflectPath<'p>
) -> Result<&T, ReflectPathError<'p>>where
T: Reflect,
fn path<'p, T>(
&self,
path: impl ReflectPath<'p>
) -> Result<&T, ReflectPathError<'p>>where
T: Reflect,
path
. Read more§fn path_mut<'p, T>(
&mut self,
path: impl ReflectPath<'p>
) -> Result<&mut T, ReflectPathError<'p>>where
T: Reflect,
fn path_mut<'p, T>(
&mut self,
path: impl ReflectPath<'p>
) -> Result<&mut T, ReflectPathError<'p>>where
T: Reflect,
path
. Read more§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> ⓘ
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> ⓘ
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§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
§fn null_value() -> T
fn null_value() -> T
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian()
.