Skip to content

Commit

Permalink
codegen
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Jul 17, 2023
1 parent 5685698 commit 4dec55e
Show file tree
Hide file tree
Showing 44 changed files with 3,738 additions and 2,444 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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.
d5ccdc80e148c8058d3885418f9c701fbae4a5fbb92defb9bd625ad27ed97a25
ed23454dff7eea3feaa346c3ef79728865d0a10f6944204cd466ddc64d8d38b1
2,031 changes: 1,612 additions & 419 deletions crates/re_types/src/archetypes/fuzzy.rs

Large diffs are not rendered by default.

172 changes: 136 additions & 36 deletions crates/re_types/src/archetypes/points2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,11 @@ impl crate::Archetype for Points2D {
)
})
})
.transpose()?
.transpose()
.map_err(|err| crate::SerializationError::Context {
location: "rerun.archetypes.Points2D#points".into(),
source: Box::new(err),
})?
},
{
self.radii
Expand All @@ -173,7 +177,11 @@ impl crate::Archetype for Points2D {
)
})
})
.transpose()?
.transpose()
.map_err(|err| crate::SerializationError::Context {
location: "rerun.archetypes.Points2D#radii".into(),
source: Box::new(err),
})?
},
{
self.colors
Expand All @@ -192,7 +200,11 @@ impl crate::Archetype for Points2D {
)
})
})
.transpose()?
.transpose()
.map_err(|err| crate::SerializationError::Context {
location: "rerun.archetypes.Points2D#colors".into(),
source: Box::new(err),
})?
},
{
self.labels
Expand All @@ -211,7 +223,11 @@ impl crate::Archetype for Points2D {
)
})
})
.transpose()?
.transpose()
.map_err(|err| crate::SerializationError::Context {
location: "rerun.archetypes.Points2D#labels".into(),
source: Box::new(err),
})?
},
{
self.draw_order
Expand All @@ -230,7 +246,11 @@ impl crate::Archetype for Points2D {
)
})
})
.transpose()?
.transpose()
.map_err(|err| crate::SerializationError::Context {
location: "rerun.archetypes.Points2D#draw_order".into(),
source: Box::new(err),
})?
},
{
self.class_ids
Expand All @@ -249,7 +269,11 @@ impl crate::Archetype for Points2D {
)
})
})
.transpose()?
.transpose()
.map_err(|err| crate::SerializationError::Context {
location: "rerun.archetypes.Points2D#class_ids".into(),
source: Box::new(err),
})?
},
{
self.keypoint_ids
Expand All @@ -269,7 +293,11 @@ impl crate::Archetype for Points2D {
)
})
})
.transpose()?
.transpose()
.map_err(|err| crate::SerializationError::Context {
location: "rerun.archetypes.Points2D#keypoint_ids".into(),
source: Box::new(err),
})?
},
{
self.instance_keys
Expand All @@ -289,7 +317,11 @@ impl crate::Archetype for Points2D {
)
})
})
.transpose()?
.transpose()
.map_err(|err| crate::SerializationError::Context {
location: "rerun.archetypes.Points2D#instance_keys".into(),
source: Box::new(err),
})?
},
]
.into_iter()
Expand All @@ -307,113 +339,181 @@ impl crate::Archetype for Points2D {
.map(|(field, array)| (field.name, array))
.collect();
let points = {
let array = arrays_by_name.get("points").ok_or_else(|| {
crate::DeserializationError::MissingData {
datatype: ::arrow2::datatypes::DataType::Null,
}
})?;
<crate::components::Point2D>::try_from_arrow_opt(&**array)?
let array = arrays_by_name
.get("points")
.ok_or_else(|| crate::DeserializationError::MissingData {
backtrace: ::backtrace::Backtrace::new_unresolved(),
})
.map_err(|err| crate::DeserializationError::Context {
location: "rerun.archetypes.Points2D#points".into(),
source: Box::new(err),
})?;
<crate::components::Point2D>::try_from_arrow_opt(&**array)
.map_err(|err| crate::DeserializationError::Context {
location: "rerun.archetypes.Points2D#points".into(),
source: Box::new(err),
})?
.into_iter()
.map(|v| {
v.ok_or_else(|| crate::DeserializationError::MissingData {
datatype: ::arrow2::datatypes::DataType::Null,
backtrace: ::backtrace::Backtrace::new_unresolved(),
})
})
.collect::<crate::DeserializationResult<Vec<_>>>()?
.collect::<crate::DeserializationResult<Vec<_>>>()
.map_err(|err| crate::DeserializationError::Context {
location: "rerun.archetypes.Points2D#points".into(),
source: Box::new(err),
})?
};
let radii = if let Some(array) = arrays_by_name.get("radii") {
Some(
<crate::components::Radius>::try_from_arrow_opt(&**array)?
<crate::components::Radius>::try_from_arrow_opt(&**array)
.map_err(|err| crate::DeserializationError::Context {
location: "rerun.archetypes.Points2D#radii".into(),
source: Box::new(err),
})?
.into_iter()
.map(|v| {
v.ok_or_else(|| crate::DeserializationError::MissingData {
datatype: ::arrow2::datatypes::DataType::Null,
backtrace: ::backtrace::Backtrace::new_unresolved(),
})
})
.collect::<crate::DeserializationResult<Vec<_>>>()?,
.collect::<crate::DeserializationResult<Vec<_>>>()
.map_err(|err| crate::DeserializationError::Context {
location: "rerun.archetypes.Points2D#radii".into(),
source: Box::new(err),
})?,
)
} else {
None
};
let colors = if let Some(array) = arrays_by_name.get("colors") {
Some(
<crate::components::Color>::try_from_arrow_opt(&**array)?
<crate::components::Color>::try_from_arrow_opt(&**array)
.map_err(|err| crate::DeserializationError::Context {
location: "rerun.archetypes.Points2D#colors".into(),
source: Box::new(err),
})?
.into_iter()
.map(|v| {
v.ok_or_else(|| crate::DeserializationError::MissingData {
datatype: ::arrow2::datatypes::DataType::Null,
backtrace: ::backtrace::Backtrace::new_unresolved(),
})
})
.collect::<crate::DeserializationResult<Vec<_>>>()?,
.collect::<crate::DeserializationResult<Vec<_>>>()
.map_err(|err| crate::DeserializationError::Context {
location: "rerun.archetypes.Points2D#colors".into(),
source: Box::new(err),
})?,
)
} else {
None
};
let labels = if let Some(array) = arrays_by_name.get("labels") {
Some(
<crate::components::Label>::try_from_arrow_opt(&**array)?
<crate::components::Label>::try_from_arrow_opt(&**array)
.map_err(|err| crate::DeserializationError::Context {
location: "rerun.archetypes.Points2D#labels".into(),
source: Box::new(err),
})?
.into_iter()
.map(|v| {
v.ok_or_else(|| crate::DeserializationError::MissingData {
datatype: ::arrow2::datatypes::DataType::Null,
backtrace: ::backtrace::Backtrace::new_unresolved(),
})
})
.collect::<crate::DeserializationResult<Vec<_>>>()?,
.collect::<crate::DeserializationResult<Vec<_>>>()
.map_err(|err| crate::DeserializationError::Context {
location: "rerun.archetypes.Points2D#labels".into(),
source: Box::new(err),
})?,
)
} else {
None
};
let draw_order = if let Some(array) = arrays_by_name.get("draw_order") {
Some(
<crate::components::DrawOrder>::try_from_arrow_opt(&**array)?
<crate::components::DrawOrder>::try_from_arrow_opt(&**array)
.map_err(|err| crate::DeserializationError::Context {
location: "rerun.archetypes.Points2D#draw_order".into(),
source: Box::new(err),
})?
.into_iter()
.next()
.flatten()
.ok_or_else(|| crate::DeserializationError::MissingData {
datatype: ::arrow2::datatypes::DataType::Null,
backtrace: ::backtrace::Backtrace::new_unresolved(),
})
.map_err(|err| crate::DeserializationError::Context {
location: "rerun.archetypes.Points2D#draw_order".into(),
source: Box::new(err),
})?,
)
} else {
None
};
let class_ids = if let Some(array) = arrays_by_name.get("class_ids") {
Some(
<crate::components::ClassId>::try_from_arrow_opt(&**array)?
<crate::components::ClassId>::try_from_arrow_opt(&**array)
.map_err(|err| crate::DeserializationError::Context {
location: "rerun.archetypes.Points2D#class_ids".into(),
source: Box::new(err),
})?
.into_iter()
.map(|v| {
v.ok_or_else(|| crate::DeserializationError::MissingData {
datatype: ::arrow2::datatypes::DataType::Null,
backtrace: ::backtrace::Backtrace::new_unresolved(),
})
})
.collect::<crate::DeserializationResult<Vec<_>>>()?,
.collect::<crate::DeserializationResult<Vec<_>>>()
.map_err(|err| crate::DeserializationError::Context {
location: "rerun.archetypes.Points2D#class_ids".into(),
source: Box::new(err),
})?,
)
} else {
None
};
let keypoint_ids = if let Some(array) = arrays_by_name.get("keypoint_ids") {
Some(
<crate::components::KeypointId>::try_from_arrow_opt(&**array)?
<crate::components::KeypointId>::try_from_arrow_opt(&**array)
.map_err(|err| crate::DeserializationError::Context {
location: "rerun.archetypes.Points2D#keypoint_ids".into(),
source: Box::new(err),
})?
.into_iter()
.map(|v| {
v.ok_or_else(|| crate::DeserializationError::MissingData {
datatype: ::arrow2::datatypes::DataType::Null,
backtrace: ::backtrace::Backtrace::new_unresolved(),
})
})
.collect::<crate::DeserializationResult<Vec<_>>>()?,
.collect::<crate::DeserializationResult<Vec<_>>>()
.map_err(|err| crate::DeserializationError::Context {
location: "rerun.archetypes.Points2D#keypoint_ids".into(),
source: Box::new(err),
})?,
)
} else {
None
};
let instance_keys = if let Some(array) = arrays_by_name.get("instance_keys") {
Some(
<crate::components::InstanceKey>::try_from_arrow_opt(&**array)?
<crate::components::InstanceKey>::try_from_arrow_opt(&**array)
.map_err(|err| crate::DeserializationError::Context {
location: "rerun.archetypes.Points2D#instance_keys".into(),
source: Box::new(err),
})?
.into_iter()
.map(|v| {
v.ok_or_else(|| crate::DeserializationError::MissingData {
datatype: ::arrow2::datatypes::DataType::Null,
backtrace: ::backtrace::Backtrace::new_unresolved(),
})
})
.collect::<crate::DeserializationResult<Vec<_>>>()?,
.collect::<crate::DeserializationResult<Vec<_>>>()
.map_err(|err| crate::DeserializationError::Context {
location: "rerun.archetypes.Points2D#instance_keys".into(),
source: Box::new(err),
})?,
)
} else {
None
Expand Down
32 changes: 24 additions & 8 deletions crates/re_types/src/archetypes/transform3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ impl crate::Archetype for Transform3D {
)
})
})
.transpose()?
.transpose()
.map_err(|err| crate::SerializationError::Context {
location: "rerun.archetypes.Transform3D#transform".into(),
source: Box::new(err),
})?
}]
.into_iter()
.flatten()
Expand All @@ -94,17 +98,29 @@ impl crate::Archetype for Transform3D {
.map(|(field, array)| (field.name, array))
.collect();
let transform = {
let array = arrays_by_name.get("transform").ok_or_else(|| {
crate::DeserializationError::MissingData {
datatype: ::arrow2::datatypes::DataType::Null,
}
})?;
<crate::components::Transform3D>::try_from_arrow_opt(&**array)?
let array = arrays_by_name
.get("transform")
.ok_or_else(|| crate::DeserializationError::MissingData {
backtrace: ::backtrace::Backtrace::new_unresolved(),
})
.map_err(|err| crate::DeserializationError::Context {
location: "rerun.archetypes.Transform3D#transform".into(),
source: Box::new(err),
})?;
<crate::components::Transform3D>::try_from_arrow_opt(&**array)
.map_err(|err| crate::DeserializationError::Context {
location: "rerun.archetypes.Transform3D#transform".into(),
source: Box::new(err),
})?
.into_iter()
.next()
.flatten()
.ok_or_else(|| crate::DeserializationError::MissingData {
datatype: ::arrow2::datatypes::DataType::Null,
backtrace: ::backtrace::Backtrace::new_unresolved(),
})
.map_err(|err| crate::DeserializationError::Context {
location: "rerun.archetypes.Transform3D#transform".into(),
source: Box::new(err),
})?
};
Ok(Self { transform })
Expand Down
Loading

0 comments on commit 4dec55e

Please sign in to comment.