Struct observation_tools_client::artifacts::Point2Builder
source · pub struct Point2Builder { /* private fields */ }
Expand description
A 2D point.
§Example
use observation_tools_client::artifacts::Point2Builder;
#[tokio::main]
async fn main() -> Result<(), observation_tools_client::ClientError> {
tracing_subscriber::fmt::init();
let client = observation_tools_client::test_utils::create_doc_test_client()?;
// Set up a 2D group:
let run = client.create_run("create_point2")?;
let group2d = run.child_uploader_2d("point2_world")?;
// Basic usage:
group2d.create_object2("my_point", Point2Builder::new(1.0, 2.0))?;
// Point2s can be created directly from tuples:
let tuple_point: Point2Builder = (3.0, 4.0).into();
group2d.create_object2("my_tuple_point", tuple_point)?;
// Convert from an nalgebra point:
let nalgebra_point: Point2Builder = nalgebra::Point2::new(5.0, 3.0).into();
group2d.create_object2("nalgebra_point", nalgebra_point)?;
client.shutdown().await?;
Ok(())
}
Implementations§
source§impl Point2Builder
impl Point2Builder
sourcepub fn new(
x: impl Into<NumberBuilder>,
y: impl Into<NumberBuilder>
) -> Point2Builder
pub fn new( x: impl Into<NumberBuilder>, y: impl Into<NumberBuilder> ) -> Point2Builder
Create a point at (x, y).
source§impl Point2Builder
impl Point2Builder
sourcepub fn origin() -> Point2Builder
pub fn origin() -> Point2Builder
Create a point at (0,0).
Trait Implementations§
source§impl Clone for Point2Builder
impl Clone for Point2Builder
source§fn clone(&self) -> Point2Builder
fn clone(&self) -> Point2Builder
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<A, B> From<(A, B)> for Point2Builder
impl<A, B> From<(A, B)> for Point2Builder
source§fn from((x, y): (A, B)) -> Point2Builder
fn from((x, y): (A, B)) -> Point2Builder
Converts to this type from the input type.
source§impl From<Point2Builder> for JsValue
impl From<Point2Builder> for JsValue
source§fn from(value: Point2Builder) -> Self
fn from(value: Point2Builder) -> Self
Converts to this type from the input type.
source§impl FromWasmAbi for Point2Builder
impl FromWasmAbi for Point2Builder
source§impl Into<Object2Builder> for Point2Builder
impl Into<Object2Builder> for Point2Builder
source§fn into(self) -> Object2Builder
fn into(self) -> Object2Builder
Converts this type into the (usually inferred) input type.
source§impl<T: Scalar + Into<NumberBuilder>> Into<Point2Builder> for Point2<T>
impl<T: Scalar + Into<NumberBuilder>> Into<Point2Builder> for Point2<T>
source§fn into(self) -> Point2Builder
fn into(self) -> Point2Builder
Converts this type into the (usually inferred) input type.
source§impl IntoWasmAbi for Point2Builder
impl IntoWasmAbi for Point2Builder
source§impl LongRefFromWasmAbi for Point2Builder
impl LongRefFromWasmAbi for Point2Builder
source§impl OptionFromWasmAbi for Point2Builder
impl OptionFromWasmAbi for Point2Builder
source§impl OptionIntoWasmAbi for Point2Builder
impl OptionIntoWasmAbi for Point2Builder
source§impl RefFromWasmAbi for Point2Builder
impl RefFromWasmAbi for Point2Builder
§type Anchor = Ref<'static, Point2Builder>
type Anchor = Ref<'static, Point2Builder>
The type that holds the reference to
Self
for the duration of the
invocation of the function that has an &Self
parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.source§impl RefMutFromWasmAbi for Point2Builder
impl RefMutFromWasmAbi for Point2Builder
source§impl TryFromJsValue for Point2Builder
impl TryFromJsValue for Point2Builder
source§impl VectorFromWasmAbi for Point2Builder
impl VectorFromWasmAbi for Point2Builder
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[Point2Builder]>
source§impl VectorIntoWasmAbi for Point2Builder
impl VectorIntoWasmAbi for Point2Builder
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[Point2Builder]>) -> Self::Abi
source§impl WasmDescribeVector for Point2Builder
impl WasmDescribeVector for Point2Builder
Auto Trait Implementations§
impl RefUnwindSafe for Point2Builder
impl Send for Point2Builder
impl Sync for Point2Builder
impl Unpin for Point2Builder
impl UnwindSafe for Point2Builder
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<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
Same as
IntoWasmAbi::Abi
source§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
Same as
IntoWasmAbi::into_abi
, except that it may throw and never
return in the case of Err
.§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.