Trait bevy::ecs::system::Resource

pub trait Resource: Send + Sync + 'static { }
Expand description

A type that can be inserted into a World as a singleton.

You can access resource data in systems using the Res and ResMut system parameters

Only one resource of each type can be stored in a World at any given time.

Examples

#[derive(Resource)]
struct MyResource { value: u32 }

world.insert_resource(MyResource { value: 42 });

fn read_resource_system(resource: Res<MyResource>) {
    assert_eq!(resource.value, 42);
}

fn write_resource_system(mut resource: ResMut<MyResource>) {
    assert_eq!(resource.value, 42);
    resource.value = 0;
    assert_eq!(resource.value, 0);
}

Implementors§

§

impl Resource for Msaawhere Msaa: Send + Sync + 'static,

§

impl Resource for TimeUpdateStrategywhere TimeUpdateStrategy: Send + Sync + 'static,

§

impl Resource for AccessibilityRequestedwhere AccessibilityRequested: Send + Sync + 'static,

§

impl Resource for Focuswhere Focus: Send + Sync + 'static,

§

impl Resource for AppTypeRegistrywhere AppTypeRegistry: Send + Sync + 'static,

§

impl Resource for ScheduleRunnerSettingswhere ScheduleRunnerSettings: Send + Sync + 'static,

§

impl Resource for AssetServerwhere AssetServer: Send + Sync + 'static,

§

impl Resource for FrameCountwhere FrameCount: Send + Sync + 'static,

§

impl Resource for TaskPoolOptionswhere TaskPoolOptions: Send + Sync + 'static,

§

impl Resource for BlitPipelinewhere BlitPipeline: Send + Sync + 'static,

§

impl Resource for ClearColorwhere ClearColor: Send + Sync + 'static,

§

impl Resource for FxaaPipelinewhere FxaaPipeline: Send + Sync + 'static,

§

impl Resource for TonemappingLutswhere TonemappingLuts: Send + Sync + 'static,

§

impl Resource for TonemappingPipelinewhere TonemappingPipeline: Send + Sync + 'static,

§

impl Resource for Diagnosticswhere Diagnostics: Send + Sync + 'static,

§

impl Resource for GamepadSettingswhere GamepadSettings: Send + Sync + 'static,

§

impl Resource for Gamepadswhere Gamepads: Send + Sync + 'static,

§

impl Resource for Toucheswhere Touches: Send + Sync + 'static,

§

impl Resource for AmbientLightwhere AmbientLight: Send + Sync + 'static,

§

impl Resource for DirectionalLightShadowMapwhere DirectionalLightShadowMap: Send + Sync + 'static,

§

impl Resource for FogMetawhere FogMeta: Send + Sync + 'static,

§

impl Resource for GlobalLightMetawhere GlobalLightMeta: Send + Sync + 'static,

§

impl Resource for GlobalVisiblePointLightswhere GlobalVisiblePointLights: Send + Sync + 'static,

§

impl Resource for LightMetawhere LightMeta: Send + Sync + 'static,

§

impl Resource for MeshBindGroupwhere MeshBindGroup: Send + Sync + 'static,

§

impl Resource for MeshPipelinewhere MeshPipeline: Send + Sync + 'static,

§

impl Resource for PointLightShadowMapwhere PointLightShadowMap: Send + Sync + 'static,

§

impl Resource for PrepassViewBindGroupwhere PrepassViewBindGroup: Send + Sync + 'static,

§

impl Resource for ShadowSamplerswhere ShadowSamplers: Send + Sync + 'static,

§

impl Resource for SkinnedMeshUniformwhere SkinnedMeshUniform: Send + Sync + 'static,

§

impl Resource for WireframeConfigwhere WireframeConfig: Send + Sync + 'static,

§

impl Resource for WireframePipelinewhere WireframePipeline: Send + Sync + 'static,

§

impl Resource for SortedCameraswhere SortedCameras: Send + Sync + 'static,

§

impl Resource for GlobalsBufferwhere GlobalsBuffer: Send + Sync + 'static,

§

impl Resource for GlobalsUniformwhere GlobalsUniform: Send + Sync + 'static,

§

impl Resource for MainToRenderAppSenderwhere MainToRenderAppSender: Send + Sync + 'static,

§

impl Resource for RenderToMainAppReceiverwhere RenderToMainAppReceiver: Send + Sync + 'static,

§

impl Resource for RenderGraphwhere RenderGraph: Send + Sync + 'static,

§

impl Resource for PipelineCachewhere PipelineCache: Send + Sync + 'static,

§

impl Resource for RenderAdapterwhere RenderAdapter: Send + Sync + 'static,

§

impl Resource for RenderAdapterInfowhere RenderAdapterInfo: Send + Sync + 'static,

§

impl Resource for RenderDevicewhere RenderDevice: Send + Sync + 'static,

§

impl Resource for RenderInstancewhere RenderInstance: Send + Sync + 'static,

§

impl Resource for RenderQueuewhere RenderQueue: Send + Sync + 'static,

§

impl Resource for MainWorldwhere MainWorld: Send + Sync + 'static,

§

impl Resource for DefaultImageSamplerwhere DefaultImageSampler: Send + Sync + 'static,

§

impl Resource for FallbackImagewhere FallbackImage: Send + Sync + 'static,

§

impl Resource for FallbackImageCubemapwhere FallbackImageCubemap: Send + Sync + 'static,

§

impl Resource for FallbackImageDepthCachewhere FallbackImageDepthCache: Send + Sync + 'static,

§

impl Resource for FallbackImageMsaaCachewhere FallbackImageMsaaCache: Send + Sync + 'static,

§

impl Resource for TextureCachewhere TextureCache: Send + Sync + 'static,

§

impl Resource for ExtractedWindowswhere ExtractedWindows: Send + Sync + 'static,

§

impl Resource for NonSendMarkerwhere NonSendMarker: Send + Sync + 'static,

§

impl Resource for ViewUniformswhere ViewUniforms: Send + Sync + 'static,

§

impl Resource for WindowSurfaceswhere WindowSurfaces: Send + Sync + 'static,

§

impl Resource for SceneSpawnerwhere SceneSpawner: Send + Sync + 'static,

§

impl Resource for ExtractedSpriteswhere ExtractedSprites: Send + Sync + 'static,

§

impl Resource for ImageBindGroupswhere ImageBindGroups: Send + Sync + 'static,

§

impl Resource for Mesh2dBindGroupwhere Mesh2dBindGroup: Send + Sync + 'static,

§

impl Resource for Mesh2dPipelinewhere Mesh2dPipeline: Send + Sync + 'static,

§

impl Resource for SpriteAssetEventswhere SpriteAssetEvents: Send + Sync + 'static,

§

impl Resource for SpriteMetawhere SpriteMeta: Send + Sync + 'static,

§

impl Resource for SpritePipelinewhere SpritePipeline: Send + Sync + 'static,

§

impl Resource for FontAtlasWarningwhere FontAtlasWarning: Send + Sync + 'static,

§

impl Resource for TextPipelinewhere TextPipeline: Send + Sync + 'static,

§

impl Resource for TextSettingswhere TextSettings: Send + Sync + 'static,

§

impl Resource for FixedTimewhere FixedTime: Send + Sync + 'static,

§

impl Resource for Timewhere Time: Send + Sync + 'static,

§

impl Resource for TimeReceiverwhere TimeReceiver: Send + Sync + 'static,

§

impl Resource for TimeSenderwhere TimeSender: Send + Sync + 'static,

§

impl Resource for ExtractedUiNodeswhere ExtractedUiNodes: Send + Sync + 'static,

§

impl Resource for FlexSurfacewhere FlexSurface: Send + Sync + 'static,

§

impl Resource for UiImageBindGroupswhere UiImageBindGroups: Send + Sync + 'static,

§

impl Resource for UiMetawhere UiMeta: Send + Sync + 'static,

§

impl Resource for UiPipelinewhere UiPipeline: Send + Sync + 'static,

§

impl Resource for UiScalewhere UiScale: Send + Sync + 'static,

§

impl Resource for UiStackwhere UiStack: Send + Sync + 'static,

§

impl Resource for WinitActionHandlerswhere WinitActionHandlers: Send + Sync + 'static,

§

impl Resource for WinitSettingswhere WinitSettings: Send + Sync + 'static,

§

impl Resource for MainThreadExecutorwhere MainThreadExecutor: Send + Sync + 'static,

§

impl Resource for Scheduleswhere Schedules: Send + Sync + 'static,

§

impl<A> Resource for ExtractedAssets<A>where A: RenderAsset, ExtractedAssets<A>: Send + Sync + 'static,

§

impl<A> Resource for PrepareNextFrameAssets<A>where A: RenderAsset, PrepareNextFrameAssets<A>: Send + Sync + 'static,

§

impl<A> Resource for RenderAssets<A>where A: RenderAsset, RenderAssets<A>: Send + Sync + 'static,

§

impl<C> Resource for ComponentUniforms<C>where C: Component + ShaderType, ComponentUniforms<C>: Send + Sync + 'static,

§

impl<E> Resource for Events<E>where E: Event, Events<E>: Send + Sync + 'static,

§

impl<M> Resource for ExtractedMaterials<M>where M: Material, ExtractedMaterials<M>: Send + Sync + 'static,

§

impl<M> Resource for MaterialPipeline<M>where M: Material, MaterialPipeline<M>: Send + Sync + 'static,

§

impl<M> Resource for PrepassPipeline<M>where M: Material, PrepassPipeline<M>: Send + Sync + 'static,

§

impl<M> Resource for Material2dPipeline<M>where M: Material2d, Material2dPipeline<M>: Send + Sync + 'static,

§

impl<P> Resource for DrawFunctions<P>where P: PhaseItem, DrawFunctions<P>: Send + Sync + 'static,

§

impl<S> Resource for SpecializedComputePipelines<S>where S: SpecializedComputePipeline, SpecializedComputePipelines<S>: Send + Sync + 'static,

§

impl<S> Resource for SpecializedMeshPipelines<S>where S: SpecializedMeshPipeline, SpecializedMeshPipelines<S>: Send + Sync + 'static,

§

impl<S> Resource for SpecializedRenderPipelines<S>where S: SpecializedRenderPipeline, SpecializedRenderPipelines<S>: Send + Sync + 'static,

§

impl<S> Resource for NextState<S>where S: States, NextState<S>: Send + Sync + 'static,

§

impl<S> Resource for State<S>where S: States, State<S>: Send + Sync + 'static,

§

impl<Source> Resource for Audio<Source>where Source: Asset + Decodable, Audio<Source>: Send + Sync + 'static,

§

impl<Source> Resource for AudioOutput<Source>where Source: Decodable, AudioOutput<Source>: Send + Sync + 'static,

§

impl<T> Resource for Assets<T>where T: Asset, Assets<T>: Send + Sync + 'static,

§

impl<T> Resource for ReportHierarchyIssue<T>where ReportHierarchyIssue<T>: Send + Sync + 'static,

§

impl<T> Resource for Axis<T>where Axis<T>: Send + Sync + 'static,

§

impl<T> Resource for Input<T>where T: Copy + Eq + Hash + Send + Sync + 'static, Input<T>: Send + Sync + 'static,

§

impl<T> Resource for RenderMaterials<T>where T: Material, RenderMaterials<T>: Send + Sync + 'static,

§

impl<T> Resource for RenderMaterials2d<T>where T: Material2d, RenderMaterials2d<T>: Send + Sync + 'static,