pub struct ContentSource { /* private fields */ }Expand description
The game supplies a builder that validates its domain and constructs all replacement state. Returning Err preserves source, generation and live game.
Implementations§
Source§impl ContentSource
impl ContentSource
pub fn new( embedded: &str, native_path: Option<&str>, ) -> Result<ContentSource, ContentError>
pub fn current(&self) -> &str
pub fn generation(&self) -> u32
Sourcepub fn poll<T>(
&mut self,
dt: f32,
build: impl FnOnce(&str) -> Result<T, ContentError>,
) -> Option<T>
pub fn poll<T>( &mut self, dt: f32, build: impl FnOnce(&str) -> Result<T, ContentError>, ) -> Option<T>
Build and adopt at most one different source. Only Some is an accepted
replacement. When this returns None, compare reload_state’s revision
before/after polling: rejection and unchanged edits update it; idle polls
retain the previous status. Invalid dt (non-finite or outside 0..=60
seconds) leaves pending work and diagnostics untouched.
A builder must construct replacement state without mutating the live game.
Auto Trait Implementations§
impl Freeze for ContentSource
impl RefUnwindSafe for ContentSource
impl Send for ContentSource
impl Sync for ContentSource
impl Unpin for ContentSource
impl UnwindSafe for ContentSource
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