Struct bevy_persistent::persistent::Persistent
source · pub struct Persistent<R: Resource + Serialize + DeserializeOwned> { /* private fields */ }Expand description
A persistent resource.
Persistent resources are Bevy resources which are automatically synchronized with the disk.
They require a name for logging, a path to be saved to and loaded from, a storage format, and a default resource in case the persistent resource is created for the first time.
They are synchronized with the disk from the moment of their creation.
Implementations§
source§impl<R: Resource + Serialize + DeserializeOwned> Persistent<R>
impl<R: Resource + Serialize + DeserializeOwned> Persistent<R>
sourcepub fn builder() -> PersistentBuilder<R>
pub fn builder() -> PersistentBuilder<R>
Creates a persistent resource builder.
sourcepub fn new(
name: impl ToString,
format: StorageFormat,
storage: Storage,
default: R
) -> Persistent<R>
pub fn new( name: impl ToString, format: StorageFormat, storage: Storage, default: R ) -> Persistent<R>
Creates a persistent resource.
source§impl<R: Resource + Serialize + DeserializeOwned> Persistent<R>
impl<R: Resource + Serialize + DeserializeOwned> Persistent<R>
sourcepub fn format(&self) -> StorageFormat
pub fn format(&self) -> StorageFormat
Gets the storage format of the resource.
source§impl<R: Resource + Serialize + DeserializeOwned> Persistent<R>
impl<R: Resource + Serialize + DeserializeOwned> Persistent<R>
source§impl<R: Resource + Serialize + DeserializeOwned> Persistent<R>
impl<R: Resource + Serialize + DeserializeOwned> Persistent<R>
Trait Implementations§
source§impl<R: Debug + Resource + Serialize + DeserializeOwned> Debug for Persistent<R>
impl<R: Debug + Resource + Serialize + DeserializeOwned> Debug for Persistent<R>
source§impl<R: Resource + Serialize + DeserializeOwned> Deref for Persistent<R>
impl<R: Resource + Serialize + DeserializeOwned> Deref for Persistent<R>
source§impl<R: Resource + Serialize + DeserializeOwned> DerefMut for Persistent<R>
impl<R: Resource + Serialize + DeserializeOwned> DerefMut for Persistent<R>
impl<R: Resource + Serialize + DeserializeOwned> Resource for Persistent<R>where Self: Send + Sync + 'static,
Auto Trait Implementations§
impl<R> RefUnwindSafe for Persistent<R>where R: RefUnwindSafe,
impl<R> Send for Persistent<R>
impl<R> Sync for Persistent<R>
impl<R> Unpin for Persistent<R>where R: Unpin,
impl<R> UnwindSafe for Persistent<R>where R: UnwindSafe,
Blanket Implementations§
§impl<T, U> AsBindGroupShaderType<U> for Twhere
U: ShaderType,
&'a T: for<'a> Into<U>,
impl<T, U> AsBindGroupShaderType<U> for Twhere U: ShaderType, &'a T: for<'a> Into<U>,
§fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
Return the
T [ShaderType] for self. When used in [AsBindGroup]
derives, it is safe to assume that all images in self exist.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert
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 + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert
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)
Convert
&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)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.