pub struct DeferredSceneLoad { /* private fields */ }Expand description
Deferred (background-thread) scene loader.
Allows JSON parsing to happen on a background thread while the
main thread continues. Call process_completed
each frame to integrate any finished loads into the SceneManager.
§Example
ⓘ
let deferred = DeferredSceneLoad::new();
deferred.request_load("level_2".into(), json_string);
// Later (e.g., next frame):
let results = deferred.process_completed(&mut manager);Implementations§
Source§impl DeferredSceneLoad
impl DeferredSceneLoad
Sourcepub fn request_load(&self, name: String, json: String)
pub fn request_load(&self, name: String, json: String)
Requests a scene load on a background thread.
Spawns a thread to parse the JSON string into SceneData.
The result is sent through a channel and can be consumed by
process_completed.
Sourcepub fn process_completed(
&self,
manager: &mut SceneManager,
) -> Vec<Result<SceneId, GoudError>>
pub fn process_completed( &self, manager: &mut SceneManager, ) -> Vec<Result<SceneId, GoudError>>
Drains all completed loads and integrates them into the manager.
For each completed parse, calls SceneLoader::load_scene to
create the scene. Returns a vec of results (one per completed
load).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DeferredSceneLoad
impl RefUnwindSafe for DeferredSceneLoad
impl Send for DeferredSceneLoad
impl !Sync for DeferredSceneLoad
impl Unpin for DeferredSceneLoad
impl UnsafeUnpin for DeferredSceneLoad
impl UnwindSafe for DeferredSceneLoad
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
Mutably borrows from an owned value. Read more
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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>
Converts
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>
Converts
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 moreSource§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
Source§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>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().