Skip to main content

Loom

Struct Loom 

Source
pub struct Loom<L: WorldLoader> { /* private fields */ }
Expand description

A ready-to-pump browser core: a Navigator wired to an owned WorldLoader.

Implementations§

Source§

impl<L: WorldLoader> Loom<L>

Source

pub fn new(worlds_root: impl Into<PathBuf>, loader: L) -> Self

Build a browser core over loader. worlds_root is the local dev-resolver root (where thread://host/path falls back to <root>/<path>/world.json).

Source

pub fn open(&mut self, locator: &str, anchor: Vec3)

Open a world by Locator (the entry to the live Thread). The world loads on a subsequent update once the async resolve+fetch lands.

Source

pub fn load_file(&mut self, path: &Path, anchor: Vec3) -> Option<Vec3>

Load a local world.json directly (the offline / startup path). Returns the spawn to place the player at.

Source

pub fn update(&mut self, dt: f32, player_pos: Vec3) -> Option<Vec3>

Advance one frame: finish an in-flight veilwalk, or begin one if the player stepped into a veil. Returns Some(spawn) when the player should be moved.

Source

pub fn title(&self) -> Option<&str>

Title of the active world.

Source

pub fn description(&self) -> Option<&str>

The active world’s one-line description (may be empty) — arrival cards.

Source

pub fn world_id(&self) -> &str

The active world’s stable id (its presence room key).

Source

pub fn sky(&self) -> Option<SkyNav>

The active world’s sky/atmosphere.

Source

pub fn portals(&self) -> &[PortalNav]

The veils in the active world (render as doorways / minimap / walk toward).

Source

pub fn presence_relays(&self) -> &[String]

The active world’s presence relays (primary first, then fallbacks).

Source

pub fn focused(&self, player_pos: Vec3) -> Option<Focus>

The inspectable placement the player is standing at, if any.

Source

pub fn near_portal(&self, player_pos: Vec3) -> Option<(&str, &str)>

The veil the player is standing in front of, as (label, destination).

Source

pub fn is_traveling(&self) -> bool

Whether a veilwalk is in flight (show a spinner).

Source

pub fn armed(&self) -> bool

Whether the engine is idle + armed (a veil will fire on contact).

Source

pub fn last_error(&self) -> Option<&str>

The most recent veilwalk failure, if any.

Source

pub fn locator(&self) -> Option<&str>

The active world’s Locator (the address bar), if it arrived by one.

Source

pub fn world_source(&self) -> Option<&str>

The active world’s raw manifest text (view-source).

Source

pub fn interact(&mut self, player_pos: Vec3) -> Vec<Action>

The player interacted with whatever they’re standing at → the [Action]s (see crate::behavior) its bound behavior module asks the browser to perform. Empty when nothing is bound (fall back to Codex/web focus).

Source

pub fn tick_behaviors(&mut self, dt: f32) -> Vec<Action>

Advance the active world’s ticking behavior modules — the heartbeat. Returns the Actions ticking Weft behaviors request.

Source

pub fn back(&mut self, anchor: Vec3) -> bool

Veilwalk back to the previous world. Returns whether a walk began.

Source

pub fn forward(&mut self, anchor: Vec3) -> bool

Veilwalk forward again after back().

Source

pub fn go_home(&mut self, anchor: Vec3) -> bool

Veilwalk to the session’s home world (by default, where it opened).

Source

pub fn loader(&self) -> &L

Borrow the loader (e.g. to read what it recorded) …

Source

pub fn navigator(&self) -> &Navigator

… or the navigator, for the full read API.

Auto Trait Implementations§

§

impl<L> !Sync for Loom<L>

§

impl<L> Freeze for Loom<L>
where L: Freeze,

§

impl<L> RefUnwindSafe for Loom<L>
where L: RefUnwindSafe,

§

impl<L> Send for Loom<L>
where L: Send,

§

impl<L> Unpin for Loom<L>
where L: Unpin,

§

impl<L> UnsafeUnpin for Loom<L>
where L: UnsafeUnpin,

§

impl<L> UnwindSafe for Loom<L>
where L: UnwindSafe,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

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