Skip to content

Commit

Permalink
codegen
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Jul 19, 2023
1 parent 0197827 commit 2585050
Show file tree
Hide file tree
Showing 17 changed files with 135 additions and 74 deletions.
2 changes: 1 addition & 1 deletion crates/re_types/source_hash.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This is a sha256 hash for all direct and indirect dependencies of this crate's build script.
# It can be safely removed at anytime to force the build script to run again.
# Check out build.rs to see how it's computed.
ba58a7d123c5fa81f04a58a6325ef65029d93f330d571176101db87596a9c0cf
2c38c0779ce86a6d7b24e420c6c4f044ecb65823a941f0fb4fddd93a986053fb
60 changes: 58 additions & 2 deletions crates/re_types/src/archetypes/transform3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,64 @@
#![allow(clippy::too_many_lines)]
#![allow(clippy::unnecessary_cast)]

/// A 3D transform
#[derive(Clone, Debug)]
/// A 3D transform.
///
/// ## Example
///
/// ```ignore
/// use rerun::{
/// experimental::{
/// archetypes::Transform3D,
/// datatypes::{
/// Angle, Mat3x3, RotationAxisAngle, Scale3D, TranslationAndMat3x3,
/// TranslationRotationScale3D,
/// },
/// },
/// MsgSender, RecordingStreamBuilder,
/// };
/// use std::f32::consts::PI;
///
/// fn main() -> Result<(), Box<dyn std::error::Error>> {
/// let (rec_stream, storage) = RecordingStreamBuilder::new("transform").memory()?;
///
/// let arrow = rerun::components::Arrow3D {
/// origin: rerun::components::Vec3D::from([0.0, 0.0, 0.0]),
/// vector: rerun::components::Vec3D::from([0.0, 1.0, 0.0]),
/// };
///
/// MsgSender::new("base")
/// .with_component(&[arrow])?
/// .send(&rec_stream)?;
///
/// MsgSender::from_archetype(
/// "base/translated",
/// &Transform3D::new(TranslationAndMat3x3::new([1.0, 0.0, 0.0], Mat3x3::IDENTITY)),
/// )?
/// .send(&rec_stream)?;
///
/// MsgSender::new("base/translated")
/// .with_component(&[arrow])?
/// .send(&rec_stream)?;
///
/// MsgSender::from_archetype(
/// "base/rotated_scaled",
/// &Transform3D::new(TranslationRotationScale3D {
/// rotation: Some(RotationAxisAngle::new([0.0, 0.0, 1.0], Angle::Radians(PI / 4.)).into()),
/// scale: Some(Scale3D::from(2.0)),
/// ..Default::default()
/// }),
/// )?
/// .send(&rec_stream)?;
///
/// MsgSender::new("base/rotated_scaled")
/// .with_component(&[arrow])?
/// .send(&rec_stream)?;
///
/// rerun::native_viewer::show(storage.take())?;
/// Ok(())
/// }
/// ```
#[derive(Clone, Debug, PartialEq)]
pub struct Transform3D {
/// The transform
pub transform: crate::components::Transform3D,
Expand Down
36 changes: 18 additions & 18 deletions crates/re_types/src/components/fuzzy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2566,7 +2566,7 @@ impl crate::Loggable for AffixFuzzer14 {
metadata: [].into(),
},
],
None,
Some(vec![0i32, 1i32, 2i32, 3i32, 4i32]),
UnionMode::Dense,
)
}
Expand Down Expand Up @@ -2798,7 +2798,7 @@ impl crate::Loggable for AffixFuzzer15 {
metadata: [].into(),
},
],
None,
Some(vec![0i32, 1i32, 2i32, 3i32, 4i32]),
UnionMode::Dense,
)
}
Expand Down Expand Up @@ -3030,7 +3030,7 @@ impl crate::Loggable for AffixFuzzer16 {
metadata: [].into(),
},
],
None,
Some(vec![0i32, 1i32, 2i32, 3i32, 4i32]),
UnionMode::Dense,
),
is_nullable: false,
Expand Down Expand Up @@ -3217,7 +3217,7 @@ impl crate::Loggable for AffixFuzzer16 {
metadata: [].into(),
},
],
None,
Some(vec![0i32, 1i32, 2i32, 3i32, 4i32]),
UnionMode::Dense,
),
is_nullable: false,
Expand Down Expand Up @@ -3477,7 +3477,7 @@ impl crate::Loggable for AffixFuzzer17 {
metadata: [].into(),
},
],
None,
Some(vec![0i32, 1i32, 2i32, 3i32, 4i32]),
UnionMode::Dense,
),
is_nullable: true,
Expand Down Expand Up @@ -3666,7 +3666,7 @@ impl crate::Loggable for AffixFuzzer17 {
metadata: [].into(),
},
],
None,
Some(vec![0i32, 1i32, 2i32, 3i32, 4i32]),
UnionMode::Dense,
),
is_nullable: true,
Expand Down Expand Up @@ -3932,7 +3932,7 @@ impl crate::Loggable for AffixFuzzer18 {
metadata: [].into(),
},
],
None,
Some(vec![0i32, 1i32, 2i32, 3i32, 4i32]),
UnionMode::Dense,
),
is_nullable: false,
Expand Down Expand Up @@ -4063,7 +4063,7 @@ impl crate::Loggable for AffixFuzzer18 {
metadata: [].into(),
},
],
None,
Some(vec![0i32, 1i32, 2i32, 3i32, 4i32]),
UnionMode::Dense,
),
is_nullable: false,
Expand Down Expand Up @@ -4197,7 +4197,7 @@ impl crate::Loggable for AffixFuzzer18 {
metadata: [].into(),
},
],
None,
Some(vec![0i32, 1i32, 2i32, 3i32, 4i32]),
UnionMode::Dense,
),
is_nullable: true,
Expand All @@ -4207,7 +4207,7 @@ impl crate::Loggable for AffixFuzzer18 {
metadata: [].into(),
},
],
None,
Some(vec![0i32, 1i32, 2i32, 3i32]),
UnionMode::Dense,
),
is_nullable: true,
Expand Down Expand Up @@ -4304,7 +4304,7 @@ impl crate::Loggable for AffixFuzzer18 {

) , 3usize) , is_nullable : false , metadata : [] . into () , }

,] , None , UnionMode :: Dense) , is_nullable : false , metadata : [] . into () , }
,] , Some (vec ! [0i32 , 1i32 , 2i32 , 3i32 , 4i32 ,]) , UnionMode :: Dense) , is_nullable : false , metadata : [] . into () , }

, Field { name : "many_required" . to_owned () , data_type : DataType :: List (Box :: new (Field { name : "item" . to_owned () , data_type : DataType :: Union (vec ! [Field { name : "_null_markers" . to_owned () , data_type : DataType :: Null , is_nullable : true , metadata : [] . into () , }

Expand Down Expand Up @@ -4346,7 +4346,7 @@ impl crate::Loggable for AffixFuzzer18 {

) , 3usize) , is_nullable : false , metadata : [] . into () , }

,] , None , UnionMode :: Dense) , is_nullable : false , metadata : [] . into () , }
,] , Some (vec ! [0i32 , 1i32 , 2i32 , 3i32 , 4i32 ,]) , UnionMode :: Dense) , is_nullable : false , metadata : [] . into () , }

)) , is_nullable : false , metadata : [] . into () , }

Expand Down Expand Up @@ -4390,11 +4390,11 @@ impl crate::Loggable for AffixFuzzer18 {

) , 3usize) , is_nullable : false , metadata : [] . into () , }

,] , None , UnionMode :: Dense) , is_nullable : true , metadata : [] . into () , }
,] , Some (vec ! [0i32 , 1i32 , 2i32 , 3i32 , 4i32 ,]) , UnionMode :: Dense) , is_nullable : true , metadata : [] . into () , }

)) , is_nullable : false , metadata : [] . into () , }

,] , None , UnionMode :: Dense) , is_nullable : true , metadata : [] . into () , }
,] , Some (vec ! [0i32 , 1i32 , 2i32 , 3i32 ,]) , UnionMode :: Dense) , is_nullable : true , metadata : [] . into () , }

))) , None) . to_logical_type () . clone () }

Expand Down Expand Up @@ -4644,7 +4644,7 @@ impl crate::Loggable for AffixFuzzer19 {
metadata: [].into(),
},
],
None,
Some(vec![0i32, 1i32, 2i32, 3i32, 4i32]),
UnionMode::Dense,
),
is_nullable: false,
Expand Down Expand Up @@ -4775,7 +4775,7 @@ impl crate::Loggable for AffixFuzzer19 {
metadata: [].into(),
},
],
None,
Some(vec![0i32, 1i32, 2i32, 3i32, 4i32]),
UnionMode::Dense,
),
is_nullable: false,
Expand Down Expand Up @@ -4909,7 +4909,7 @@ impl crate::Loggable for AffixFuzzer19 {
metadata: [].into(),
},
],
None,
Some(vec![0i32, 1i32, 2i32, 3i32, 4i32]),
UnionMode::Dense,
),
is_nullable: true,
Expand All @@ -4919,7 +4919,7 @@ impl crate::Loggable for AffixFuzzer19 {
metadata: [].into(),
},
],
None,
Some(vec![0i32, 1i32, 2i32, 3i32]),
UnionMode::Dense,
),
is_nullable: true,
Expand Down
1 change: 1 addition & 0 deletions crates/re_types/src/components/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ mod point2d_ext;
mod radius;
mod radius_ext;
mod transform3d;
mod transform3d_ext;

pub use self::class_id::ClassId;
pub use self::color::Color;
Expand Down
30 changes: 15 additions & 15 deletions crates/re_types/src/components/transform3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
#![allow(clippy::unnecessary_cast)]

/// An affine transform between two 3D spaces, represented in a given direction.
#[derive(Clone, Debug)]
pub struct Transform3D {
#[derive(Clone, Debug, PartialEq)]
pub struct Transform3D(
/// Representation of the transform.
pub repr: crate::datatypes::Transform3D,
}
pub crate::datatypes::Transform3D,
);

impl<'a> From<Transform3D> for ::std::borrow::Cow<'a, Transform3D> {
#[inline]
Expand Down Expand Up @@ -174,7 +174,7 @@ impl crate::Loggable for Transform3D {
metadata: [].into(),
},
],
None,
Some(vec![0i32, 1i32, 2i32]),
UnionMode::Dense,
),
is_nullable: false,
Expand All @@ -185,7 +185,7 @@ impl crate::Loggable for Transform3D {
metadata: [].into(),
},
],
None,
Some(vec![0i32, 1i32, 2i32]),
UnionMode::Dense,
),
is_nullable: true,
Expand Down Expand Up @@ -222,7 +222,7 @@ impl crate::Loggable for Transform3D {
metadata: [].into(),
},
],
None,
Some(vec![0i32, 1i32, 2i32]),
UnionMode::Dense,
),
is_nullable: true,
Expand All @@ -239,7 +239,7 @@ impl crate::Loggable for Transform3D {
metadata: [].into(),
},
],
None,
Some(vec![0i32, 1i32, 2i32]),
UnionMode::Dense,
)
}
Expand All @@ -255,26 +255,26 @@ impl crate::Loggable for Transform3D {
use crate::Loggable as _;
use ::arrow2::{array::*, datatypes::*};
Ok({
let (somes, repr): (Vec<_>, Vec<_>) = data
let (somes, data0): (Vec<_>, Vec<_>) = data
.into_iter()
.map(|datum| {
let datum: Option<::std::borrow::Cow<'a, Self>> = datum.map(Into::into);
let datum = datum.map(|datum| {
let Self { repr } = datum.into_owned();
repr
let Self(data0) = datum.into_owned();
data0
});
(datum.is_some(), datum)
})
.unzip();
let repr_bitmap: Option<::arrow2::bitmap::Bitmap> = {
let data0_bitmap: Option<::arrow2::bitmap::Bitmap> = {
let any_nones = somes.iter().any(|some| !*some);
any_nones.then(|| somes.into())
};
{
_ = repr_bitmap;
_ = data0_bitmap;
_ = extension_wrapper;
crate::datatypes::Transform3D::try_to_arrow_opt(
repr,
data0,
Some("rerun.components.Transform3D"),
)?
}
Expand All @@ -301,7 +301,7 @@ impl crate::Loggable for Transform3D {
backtrace: ::backtrace::Backtrace::new_unresolved(),
})
})
.map(|res| res.map(|repr| Some(Self { repr })))
.map(|res| res.map(|v| Some(Self(v))))
.collect::<crate::DeserializationResult<Vec<Option<_>>>>()
.map_err(|err| crate::DeserializationError::Context {
location: "rerun.components.Transform3D#repr".into(),
Expand Down
2 changes: 1 addition & 1 deletion crates/re_types/src/datatypes/angle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl crate::Loggable for Angle {
metadata: [].into(),
},
],
None,
Some(vec![0i32, 1i32, 2i32]),
UnionMode::Dense,
)
}
Expand Down
Loading

0 comments on commit 2585050

Please sign in to comment.