use super::*;
#[inline]
fn shape_has_parent_chain(id: ShapeId) -> bool {
unsafe { ffi::b2Shape_GetParentChain(id.into_raw()) }.index1 != 0
}
pub(crate) fn check_orphan_shape_mutation_target(id: ShapeId) -> Result<()> {
if shape_has_parent_chain(id) {
Err(Error::ChainOwnedShape)
} else {
Ok(())
}
}
pub(crate) fn set_chain_segment_checked(id: ShapeId, chain_segment: &ChainSegment) -> Result<()> {
check_chain_segment_geometry_valid(chain_segment)?;
check_orphan_shape_mutation_target(id)?;
let raw = chain_segment.into_raw();
unsafe { ffi::b2Shape_SetChainSegment(id.into_raw(), &raw) };
Ok(())
}