Struct observation_tools_client::artifacts::Rect2Builder
source · pub struct Rect2Builder { /* private fields */ }
Expand description
An axis-aligned rectangle.
§Example
use observation_tools_client::artifacts::Object2Builder;
use observation_tools_client::artifacts::Rect2Builder;
use observation_tools_client::artifacts::Transform2Builder;
use observation_tools_client::artifacts::Vector2Builder;
#[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_rect2")?;
let group2d = run.child_uploader_2d("rect2_world")?;
// Basic usage:
group2d.create_object2("my_rect", Rect2Builder::from((10.0, 5.0)))?;
// Translate the rect, use shorthand (a,b) notation to create vectors and points
let mut rect2: Object2Builder = Rect2Builder::from((5.0, 2.5)).into();
rect2.add_transform(Transform2Builder::translation((2.5, 5.0)));
group2d.create_object2("translated_rect", rect2)?;
client.shutdown().await?;
Ok(())
}
Implementations§
source§impl Rect2Builder
impl Rect2Builder
pub fn new(size: &Vector2Builder) -> Rect2Builder
source§impl Rect2Builder
impl Rect2Builder
pub fn from(size: impl Into<Vector2Builder>) -> Rect2Builder
Trait Implementations§
source§impl Clone for Rect2Builder
impl Clone for Rect2Builder
source§fn clone(&self) -> Rect2Builder
fn clone(&self) -> Rect2Builder
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 From<Rect2Builder> for JsValue
impl From<Rect2Builder> for JsValue
source§fn from(value: Rect2Builder) -> Self
fn from(value: Rect2Builder) -> Self
Converts to this type from the input type.
source§impl FromWasmAbi for Rect2Builder
impl FromWasmAbi for Rect2Builder
source§impl Into<Object2Builder> for Rect2Builder
impl Into<Object2Builder> for Rect2Builder
source§fn into(self) -> Object2Builder
fn into(self) -> Object2Builder
Converts this type into the (usually inferred) input type.
source§impl IntoWasmAbi for Rect2Builder
impl IntoWasmAbi for Rect2Builder
source§impl LongRefFromWasmAbi for Rect2Builder
impl LongRefFromWasmAbi for Rect2Builder
source§impl OptionFromWasmAbi for Rect2Builder
impl OptionFromWasmAbi for Rect2Builder
source§impl OptionIntoWasmAbi for Rect2Builder
impl OptionIntoWasmAbi for Rect2Builder
source§impl RefFromWasmAbi for Rect2Builder
impl RefFromWasmAbi for Rect2Builder
§type Anchor = Ref<'static, Rect2Builder>
type Anchor = Ref<'static, Rect2Builder>
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 Rect2Builder
impl RefMutFromWasmAbi for Rect2Builder
source§impl TryFromJsValue for Rect2Builder
impl TryFromJsValue for Rect2Builder
source§impl VectorFromWasmAbi for Rect2Builder
impl VectorFromWasmAbi for Rect2Builder
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[Rect2Builder]>
source§impl VectorIntoWasmAbi for Rect2Builder
impl VectorIntoWasmAbi for Rect2Builder
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[Rect2Builder]>) -> Self::Abi
source§impl WasmDescribeVector for Rect2Builder
impl WasmDescribeVector for Rect2Builder
Auto Trait Implementations§
impl RefUnwindSafe for Rect2Builder
impl Send for Rect2Builder
impl Sync for Rect2Builder
impl Unpin for Rect2Builder
impl UnwindSafe for Rect2Builder
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.