Visu

Struct Visu 

pub struct Visu {
    pub client: VisuClient,
}
Expand description

The high-level client for the 3D visualization service.

Fields§

§client: VisuClient

The underlying client router.

Implementations§

§

impl Visu

pub fn config(&self) -> Config

Access the UI configuration write-access helper.

The returned helper builds live instructions for the scene, grid and logo settings, e.g. visu.config().scene().grid().section_size(2.0).

§

impl Visu

pub fn add_line_basic_material( &self, color: [f64; 3], options: LineBasicMaterialOptions, ) -> Result<LineBasicMaterial>

Adds a line basic material.

§

impl Visu

pub fn add_mesh_basic_material( &self, color: [f64; 3], options: MeshBasicMaterialOptions, ) -> Result<MeshBasicMaterial>

Adds a mesh basic material.

§

impl Visu

pub fn add_mesh_standard_material( &self, color: [f64; 3], options: MeshStandardMaterialOptions, ) -> Result<MeshStandardMaterial>

Adds a mesh standard material.

§

impl Visu

pub fn add_points_material( &self, color: [f64; 3], options: PointsMaterialOptions, ) -> Result<PointsMaterial>

Adds a points material.

§

impl Visu

pub fn add_axes(&self, options: AxesOptions) -> Result<Axes>

Adds an axes helper object.

pub fn get_axes(&self, identifier: &str) -> Result<Axes>

Gets the axes object for the provided identifier.

§Errors

Returns Error::ObjectTypeMismatch if the server object is not an axes helper.

§

impl Visu

pub fn add_box(&self, options: BoxOptions) -> Result<Box>

Adds a box object.

pub fn get_box(&self, identifier: &str) -> Result<Box>

Gets the box object for the provided identifier.

§Errors

Returns Error::ObjectTypeMismatch if the server object is not a box.

§

impl Visu

pub fn add_camera(&self, options: CameraOptions) -> Result<Camera>

Adds a camera object.

pub fn get_camera(&self, identifier: &str) -> Result<Camera>

Gets the camera object for the provided identifier.

§Errors

Returns Error::ObjectTypeMismatch if the server object is not a camera.

§

impl Visu

pub fn add_cylinder(&self, options: CylinderOptions) -> Result<Cylinder>

Adds a cylinder object.

pub fn get_cylinder(&self, identifier: &str) -> Result<Cylinder>

Gets the cylinder object for the provided identifier.

§Errors

Returns Error::ObjectTypeMismatch if the server object is not a cylinder.

§

impl Visu

pub fn add_line(&self, points: PointsType, options: LineOptions) -> Result<Line>

Adds a line object.

If options.segments is enabled the number of points must be even.

pub fn get_line(&self, identifier: &str) -> Result<Line>

Gets the line object for the provided identifier.

§Errors

Returns Error::ObjectTypeMismatch if the server object is not a line.

§

impl Visu

pub fn add_model( &self, source: ModelSource, options: ModelOptions, ) -> Result<Model>

Adds a model object loaded from a local path or remote URL.

Local files are cached by content hash and remote URLs by URL, so the model is only uploaded when it is not already present on the server.

Returns Error::Value if both rotation and quaternion are set.

pub fn get_model(&self, identifier: &str) -> Result<Model>

Gets the model object for the provided identifier.

§Errors

Returns Error::ObjectTypeMismatch if the server object is not a model.

§

impl Visu

pub fn add_point_cloud( &self, data_format: PointCloudFormat, options: PointCloudOptions, ) -> Result<PointCloud>

Adds a point cloud object.

pub fn get_point_cloud(&self, identifier: &str) -> Result<PointCloud>

Gets the point cloud object for the provided identifier.

§Errors

Returns Error::ObjectTypeMismatch if the server object is not a point cloud.

§

impl Visu

pub fn add_sphere(&self, options: SphereOptions) -> Result<Sphere>

Adds a sphere object.

pub fn get_sphere(&self, identifier: &str) -> Result<Sphere>

Gets the sphere object for the provided identifier.

§Errors

Returns Error::ObjectTypeMismatch if the server object is not a sphere.

§

impl Visu

pub fn add_text_panel( &self, text: &str, options: TextPanelOptions, ) -> Result<TextPanel>

Adds a text panel object.

pub fn get_text_panel(&self, identifier: &str) -> Result<TextPanel>

Gets the text panel object for the provided identifier.

§Errors

Returns Error::ObjectTypeMismatch if the server object is not a text panel.

§

impl Visu

pub fn new( http_uri: &str, clear: bool, ignore_meta_check: bool, clear_all: bool, identifier: Option<String>, ) -> Result<Self>

Initializes the client for the 3D visualization service.

  • clear clears all objects and materials for this client’s identifier.
  • clear_all clears the entire scene (takes precedence over clear).
  • ignore_meta_check skips the server name and version check.

pub fn with_timeout( http_uri: &str, clear: bool, ignore_meta_check: bool, clear_all: bool, identifier: Option<String>, timeout_s: f64, ) -> Result<Self>

Initializes the client with an explicit request timeout.

pub fn delete(&self, obj: &Obj) -> Result<()>

Deletes an object from the 3D visualization.

pub fn get_objects(&self) -> Result<Vec<AnyObject>>

Gets all objects in the scene as their typed write-access helpers.

pub fn get_object(&self, identifier: &str) -> Result<AnyObject>

Gets a single object by its identifier as its typed write-access helper.

pub fn add_hash_instruction( &self, anchor: &str, instructions: Vec<Instruction>, ) -> Result<AnchorInstruction>

Adds a hash (anchor) instruction.

The instructions are flattened into a single ordered map and stored under anchor.

pub fn connect(&mut self) -> Result<()>

Opens the live websocket connection.

pub fn disconnect(&mut self)

Closes the live websocket connection (no-op if not connected).

pub fn connection(&mut self) -> Result<ConnectionGuard<'_>>

Opens the live connection and returns an RAII guard that closes it on drop.

The guard dereferences to Visu, so live operations such as Visu::update can be called through it.

pub fn update(&mut self, instructions: Vec<Instruction>) -> Result<()>

Sends live updates via the websocket connection.

Requires an open connection (see Visu::connection).

Trait Implementations§

§

impl Debug for Visu

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Visu

§

impl !RefUnwindSafe for Visu

§

impl Send for Visu

§

impl Sync for Visu

§

impl Unpin for Visu

§

impl !UnwindSafe for Visu

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.

§

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

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: 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
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: 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> 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 = 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<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

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
§

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

§

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

§

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