Skip to main content

Session

Struct Session 

Source
pub struct Session<A: Stores> {
    pub app: A,
    /* private fields */
}
Expand description

A CPU value with no GPU or window object; Send, and it builds for wasm32.

Fields§

§app: A

Implementations§

Source§

impl<A: Stores> Session<A>

Source

pub fn new(app: A, config: SimConfig) -> Self

Source

pub fn config(&self) -> SimConfig

Source

pub fn scene(&self) -> SceneId

Source

pub fn current_tick(&self) -> Tick

Source

pub fn faulted_phase(&self) -> Option<Phase>

Source

pub fn phase_error(&self) -> Option<PhaseError>

Source

pub fn register_domain<S: DomainSpace>( &mut self, builder: DomainBuilder<S>, ) -> DomainHandle<S>

Source

pub fn domains(&self) -> &Domains

Source

pub fn domains_mut(&mut self) -> &mut Domains

Source

pub fn views(&self) -> &Views

Source

pub fn views_mut(&mut self) -> &mut Views

Source

pub fn entities(&self) -> &Entities

Source

pub fn submit(&mut self, command: Command<A>) -> RequestId

Source

pub fn prepare(&mut self, geometry: PreparedGeometry) -> PreparedId

Source

pub fn prepared(&self, id: PreparedId) -> Option<&PreparedGeometry>

Source

pub fn add_palette(&mut self, colors: Vec<[f32; 4]>) -> PaletteId

Two colors per prepared segment, start then end, read in the prepared geometry’s own order; a segment past the palette’s end keeps the material color.

Source

pub fn palette(&self, id: PaletteId) -> Option<&[[f32; 4]]>

Source

pub fn add_material(&mut self, material: Material) -> MaterialId

Source

pub fn material(&self, id: MaterialId) -> Option<&Material>

Source

pub fn system( &mut self, phase: Phase, name: &'static str, system: impl System<A>, )

Source

pub fn system_at( &mut self, phase: Phase, order: Order, name: &'static str, system: impl System<A>, ) -> Option<()>

None when no entry of that phase has the named anchor.

Source

pub fn entries(&self, phase: Phase) -> &[SystemEntry<A>]

Source

pub fn dispatch<R>(&mut self, f: impl FnOnce(&mut Dispatch<'_, A>) -> R) -> R

Source

pub fn bridges(&self) -> &Relation<Bridge>

Source

pub fn bridge(&mut self, spec: BridgeSpec) -> Result<LinkId, BridgeError>

Source

pub fn dragging(&self) -> Option<Drag>

Source

pub fn grab(&mut self, ndc: [f32; 2], time: f64) -> Result<Pick, DragError>

Source

pub fn drag( &mut self, ndc: [f32; 2], time: f64, ) -> Result<ChartPoint, DragError>

Source

pub fn release(&mut self) -> Option<DragRelease>

Source

pub fn release_at(&mut self, time: f64) -> Option<DragRelease>

Source

pub fn cancel_drag(&mut self) -> Option<DragRelease>

Source

pub fn boundary(&mut self, input: Input) -> Result<Growth, PhaseError>

Source

pub fn tick(&mut self) -> Result<(), PhaseError>

Source

pub fn publish(&mut self, into: &mut Publication) -> Result<(), PhaseError>

Source

pub fn publish_at( &mut self, into: &mut Publication, alpha: f32, ) -> Result<(), PhaseError>

Draws each pose alpha of the way from where it stood before the last tick to where it stands now, with alpha clamped to [0, 1] and NaN taken as 1.

Source

pub fn take_input(&mut self) -> Input

Call after the frame’s last tick; systems see an empty input until the next boundary.

Source

pub fn results(&self) -> &[CommandResult]

Source

pub fn pick(&self, ndc: [f32; 2]) -> Option<Pick>

Source

pub fn snapshot(&self) -> Result<SessionSnapshot<A>, RestoreError>

Unfinished while a phase is incomplete and Pending while deferred mutation remains.

Source

pub fn restore(&mut self, from: &SessionSnapshot<A>) -> Result<(), RestoreError>

Validates ownership and every domain before it cancels pending commands and advances the epoch; a failure after that faults the session until a later restore succeeds.

Source

pub fn set_initial(&mut self) -> Result<(), RestoreError>

Source

pub fn reset(&mut self) -> Result<(), RestoreError>

Auto Trait Implementations§

§

impl<A> Freeze for Session<A>
where A: Freeze, <A as Stores>::Snapshot: Freeze,

§

impl<A> !RefUnwindSafe for Session<A>

§

impl<A> Send for Session<A>

§

impl<A> !Sync for Session<A>

§

impl<A> Unpin for Session<A>
where A: Unpin, <A as Stores>::Snapshot: Unpin,

§

impl<A> UnsafeUnpin for Session<A>

§

impl<A> !UnwindSafe for Session<A>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more