pub struct Compound { /* private fields */ }Expand description
A compound shape with an aabb bounding volume.
A compound shape is a shape composed of the union of several simpler shape. This is the main way of creating a concave shape from convex parts. Each parts can have its own delta transformation to shift or rotate it with regard to the other shapes.
Implementations§
Source§impl Compound
 
impl Compound
Sourcepub fn new(shapes: Vec<(Isometry<f32>, SharedShape)>) -> Compound
 
pub fn new(shapes: Vec<(Isometry<f32>, SharedShape)>) -> Compound
Builds a new compound shape from a collection of sub-shapes.
A compound shape combines multiple primitive shapes into a single composite shape, each with its own relative position and orientation. This is the primary way to create concave shapes from convex primitives. The compound internally builds a Bounding Volume Hierarchy (BVH) for efficient collision detection.
§Arguments
- shapes- A vector of (position, shape) pairs. Each pair defines:- An Isometryrepresenting the sub-shape’s position and orientation relative to the compound’s origin
- A SharedShapecontaining the actual geometry
 
- An 
§Panics
- If the input vector is empty (a compound must contain at least one shape)
- If any of the provided shapes are themselves composite shapes (nested composites are not allowed)
§Performance
The BVH is built using a binned construction strategy optimized for static scenes. For large compounds (100+ shapes), construction may take noticeable time but provides excellent query performance.
§Example
use parry3d::math::Isometry;
use nalgebra::Vector3;
// Create a compound shape resembling a dumbbell
let shapes = vec![
    // Left sphere
    (
        Isometry::translation(-2.0, 0.0, 0.0),
        SharedShape::new(Ball::new(0.5))
    ),
    // Center bar
    (
        Isometry::identity(),
        SharedShape::new(Cuboid::new(Vector3::new(2.0, 0.2, 0.2)))
    ),
    // Right sphere
    (
        Isometry::translation(2.0, 0.0, 0.0),
        SharedShape::new(Ball::new(0.5))
    ),
];
let compound = Compound::new(shapes);
// The compound now contains all three shapes
assert_eq!(compound.shapes().len(), 3);
// Create an L-shaped compound
let shapes = vec![
    // Vertical rectangle
    (
        Isometry::translation(0.0, 1.0),
        SharedShape::new(Cuboid::new(Vector2::new(0.5, 1.0)))
    ),
    // Horizontal rectangle
    (
        Isometry::translation(1.0, 0.0),
        SharedShape::new(Cuboid::new(Vector2::new(1.0, 0.5)))
    ),
];
let l_shape = Compound::new(shapes);
assert_eq!(l_shape.shapes().len(), 2);Source§impl Compound
 
impl Compound
Sourcepub fn shapes(&self) -> &[(Isometry<f32>, SharedShape)]
 
pub fn shapes(&self) -> &[(Isometry<f32>, SharedShape)]
Returns a slice containing all sub-shapes and their positions in this compound.
Each element in the returned slice is a tuple containing:
- The sub-shape’s position and orientation (Isometry) relative to the compound’s origin
- The sub-shape itself (SharedShape)
The order of shapes matches the order they were provided to Compound::new.
The index of each shape in this slice corresponds to its ID used in other operations
like BVH traversal.
§Returns
A slice of (isometry, shape) pairs representing all sub-shapes in this compound.
§Example
use parry3d::math::Isometry;
use nalgebra::Vector3;
let shapes = vec![
    (Isometry::translation(1.0, 0.0, 0.0), SharedShape::new(Ball::new(0.5))),
    (Isometry::translation(-1.0, 0.0, 0.0), SharedShape::new(Ball::new(0.3))),
    (Isometry::identity(), SharedShape::new(Cuboid::new(Vector3::new(0.5, 0.5, 0.5)))),
];
let compound = Compound::new(shapes);
// Access all shapes
assert_eq!(compound.shapes().len(), 3);
// Inspect individual shapes
for (i, (position, shape)) in compound.shapes().iter().enumerate() {
    println!("Shape {} at position: {:?}", i, position.translation);
    // Check if it's a ball
    if let Some(ball) = shape.as_ball() {
        println!("  Ball with radius: {}", ball.radius);
    }
}§Example: Modifying Sub-Shape Positions
use parry3d::math::Isometry;
let shapes = vec![
    (Isometry::translation(0.0, 0.0, 0.0), SharedShape::new(Ball::new(1.0))),
    (Isometry::translation(2.0, 0.0, 0.0), SharedShape::new(Ball::new(1.0))),
];
let compound = Compound::new(shapes);
// Note: To modify positions, you need to create a new compound
let mut new_shapes: Vec<_> = compound.shapes()
    .iter()
    .map(|(pos, shape)| {
        // Shift all shapes up by 1 unit
        let new_pos = pos * Isometry::translation(0.0, 1.0, 0.0);
        (new_pos, shape.clone())
    })
    .collect();
let shifted_compound = Compound::new(new_shapes);
assert_eq!(shifted_compound.shapes().len(), 2);Sourcepub fn local_aabb(&self) -> &Aabb
 
pub fn local_aabb(&self) -> &Aabb
Returns the Axis-Aligned Bounding Box (AABB) of this compound in local space.
The local AABB is the smallest axis-aligned box that contains all sub-shapes in the compound, computed in the compound’s local coordinate system. This AABB is automatically computed when the compound is created and encompasses all sub-shapes at their specified positions.
§Returns
A reference to the Aabb representing the compound’s bounding box in local space.
§Use Cases
- Broad-phase collision detection: Quick rejection tests before detailed queries
- Spatial partitioning: Organizing compounds in larger spatial structures
- Culling: Determining if the compound is visible or relevant to a query
- Size estimation: Getting approximate dimensions of the compound
§Example
use parry3d::math::Isometry;
use nalgebra::Point3;
let shapes = vec![
    (Isometry::translation(-2.0, 0.0, 0.0), SharedShape::new(Ball::new(0.5))),
    (Isometry::translation(2.0, 0.0, 0.0), SharedShape::new(Ball::new(0.5))),
];
let compound = Compound::new(shapes);
let aabb = compound.local_aabb();
// The AABB should contain both balls
// Left ball extends from -2.5 to -1.5 on X axis
// Right ball extends from 1.5 to 2.5 on X axis
assert!(aabb.mins.x <= -2.5);
assert!(aabb.maxs.x >= 2.5);
// Check if a point is inside the AABB
assert!(aabb.contains_local_point(&Point3::origin()));
assert!(!aabb.contains_local_point(&Point3::new(10.0, 0.0, 0.0)));§Example: Computing Compound Dimensions
use parry3d::math::Isometry;
use nalgebra::Vector3;
let shapes = vec![
    (Isometry::identity(), SharedShape::new(Cuboid::new(Vector3::new(1.0, 1.0, 1.0)))),
    (Isometry::translation(3.0, 0.0, 0.0), SharedShape::new(Cuboid::new(Vector3::new(0.5, 0.5, 0.5)))),
];
let compound = Compound::new(shapes);
let aabb = compound.local_aabb();
// Calculate the total dimensions
let dimensions = aabb.maxs - aabb.mins;
println!("Compound dimensions: {:?}", dimensions);
// The compound extends from -1.0 to 3.5 on the X axis (4.5 units total)
assert!((dimensions.x - 4.5).abs() < 1e-5);Sourcepub fn local_bounding_sphere(&self) -> BoundingSphere
 
pub fn local_bounding_sphere(&self) -> BoundingSphere
Returns the bounding sphere of this compound in local space.
The bounding sphere is the smallest sphere that contains all sub-shapes in the compound. It is computed from the compound’s AABB by finding the sphere that tightly encloses that box. This provides a simple, rotation-invariant bounding volume useful for certain collision detection algorithms.
§Returns
A BoundingSphere centered in local space that contains the entire compound.
§Performance
This method is very fast as it simply computes the bounding sphere from the pre-computed AABB. The bounding sphere is not cached - it’s computed on each call.
§Comparison with AABB
- Bounding Sphere: Rotation-invariant, simpler intersection tests, but often looser fit
- AABB: Tighter fit for axis-aligned objects, but must be recomputed when rotated
§Example
use parry3d::math::Isometry;
let shapes = vec![
    (Isometry::translation(-1.0, 0.0, 0.0), SharedShape::new(Ball::new(0.5))),
    (Isometry::translation(1.0, 0.0, 0.0), SharedShape::new(Ball::new(0.5))),
];
let compound = Compound::new(shapes);
let bounding_sphere = compound.local_bounding_sphere();
// The bounding sphere should contain both balls
println!("Center: {:?}", bounding_sphere.center());
println!("Radius: {}", bounding_sphere.radius());
// The center should be near the origin
assert!(bounding_sphere.center().coords.norm() < 0.1);
// The radius should be at least 1.5 (distance to ball edge: 1.0 + 0.5)
assert!(bounding_sphere.radius() >= 1.5);§Example: Using Bounding Sphere for Quick Rejection
use parry3d::math::Isometry;
use nalgebra::{Vector3, Point3};
let shapes = vec![
    (Isometry::identity(), SharedShape::new(Cuboid::new(Vector3::new(1.0, 1.0, 1.0)))),
    (Isometry::translation(2.0, 0.0, 0.0), SharedShape::new(Cuboid::new(Vector3::new(0.5, 0.5, 0.5)))),
];
let compound = Compound::new(shapes);
let sphere = compound.local_bounding_sphere();
// Quick test: is a point potentially inside the compound?
let test_point = Point3::new(5.0, 5.0, 5.0);
let distance_to_center = (test_point - sphere.center()).norm();
if distance_to_center > sphere.radius() {
    println!("Point is definitely outside the compound");
    assert!(distance_to_center > sphere.radius());
} else {
    println!("Point might be inside - need detailed check");
}Sourcepub fn aabbs(&self) -> &[Aabb]
 
pub fn aabbs(&self) -> &[Aabb]
Returns a slice of AABBs, one for each sub-shape in this compound.
Each AABB in the returned slice corresponds to the bounding box of a sub-shape,
transformed to the compound’s local coordinate system. The AABBs are stored in
the same order as the shapes returned by Compound::shapes, so index i in
this slice corresponds to shape i.
These AABBs are used internally by the BVH for efficient spatial queries and collision detection. They are pre-computed during compound construction.
§Returns
A slice of Aabb representing the local-space bounding boxes of each sub-shape.
§Use Cases
- Inspecting individual sub-shape bounds without accessing the shapes themselves
- Custom spatial queries or culling operations
- Debugging and visualization of the compound’s structure
- Understanding the BVH’s leaf nodes
§Example
use parry3d::math::Isometry;
use nalgebra::Vector3;
let shapes = vec![
    (Isometry::translation(-2.0, 0.0, 0.0), SharedShape::new(Ball::new(0.5))),
    (Isometry::identity(), SharedShape::new(Cuboid::new(Vector3::new(1.0, 1.0, 1.0)))),
    (Isometry::translation(3.0, 0.0, 0.0), SharedShape::new(Ball::new(0.3))),
];
let compound = Compound::new(shapes);
// Get AABBs for all sub-shapes
let aabbs = compound.aabbs();
assert_eq!(aabbs.len(), 3);
// Inspect each AABB
for (i, aabb) in aabbs.iter().enumerate() {
    println!("Shape {} AABB:", i);
    println!("  Min: {:?}", aabb.mins);
    println!("  Max: {:?}", aabb.maxs);
    let center = aabb.center();
    let extents = aabb.half_extents();
    println!("  Center: {:?}", center);
    println!("  Half-extents: {:?}", extents);
}§Example: Finding Sub-Shapes in a Region
use parry3d::math::Isometry;
use parry3d::bounding_volume::Aabb;
use nalgebra::Point3;
let shapes = vec![
    (Isometry::translation(-5.0, 0.0, 0.0), SharedShape::new(Ball::new(0.5))),
    (Isometry::translation(0.0, 0.0, 0.0), SharedShape::new(Ball::new(0.5))),
    (Isometry::translation(5.0, 0.0, 0.0), SharedShape::new(Ball::new(0.5))),
];
let compound = Compound::new(shapes);
// Define a query point
let query_point = Point3::origin();
// Find which sub-shapes might contain this point
let potentially_containing: Vec<usize> = compound.aabbs()
    .iter()
    .enumerate()
    .filter(|(_, aabb)| aabb.contains_local_point(&query_point))
    .map(|(i, _)| i)
    .collect();
// Only the middle shape (index 1) should contain the origin
assert_eq!(potentially_containing.len(), 1);
assert_eq!(potentially_containing[0], 1);Sourcepub fn bvh(&self) -> &Bvh
 
pub fn bvh(&self) -> &Bvh
Returns the Bounding Volume Hierarchy (BVH) used for efficient spatial queries.
The BVH is an acceleration structure that organizes the sub-shapes hierarchically for fast collision detection and spatial queries. It enables logarithmic-time queries instead of linear searches through all sub-shapes. The BVH is automatically built when the compound is created using a binned construction strategy.
§Returns
A reference to the Bvh acceleration structure for this compound.
§Use Cases
- Custom spatial queries: Traverse the BVH for specialized collision detection
- Ray casting: Efficiently find which sub-shapes intersect a ray
- AABB queries: Find all sub-shapes intersecting a region
- Debugging: Inspect the BVH structure and quality
- Performance analysis: Understand query performance characteristics
§Performance
The BVH provides O(log n) query performance for most spatial operations, where n is the number of sub-shapes. For compounds with many shapes (100+), the BVH provides dramatic speedups compared to naive linear searches.
§Example
use parry3d::math::Isometry;
use parry3d::bounding_volume::Aabb;
use nalgebra::Point3;
let shapes = vec![
    (Isometry::translation(-3.0, 0.0, 0.0), SharedShape::new(Ball::new(0.5))),
    (Isometry::translation(0.0, 0.0, 0.0), SharedShape::new(Ball::new(0.5))),
    (Isometry::translation(3.0, 0.0, 0.0), SharedShape::new(Ball::new(0.5))),
];
let compound = Compound::new(shapes);
let bvh = compound.bvh();
// The BVH provides efficient hierarchical organization
assert_eq!(bvh.leaf_count(), 3);
println!("BVH root AABB: {:?}", bvh.root_aabb());§Example: Accessing BVH for Custom Queries
use parry3d::math::Isometry;
let mut shapes = vec![];
for i in 0..10 {
    let x = i as f32 * 2.0;
    shapes.push((
        Isometry::translation(x, 0.0, 0.0),
        SharedShape::new(Ball::new(0.5))
    ));
}
let compound = Compound::new(shapes);
let bvh = compound.bvh();
// The BVH organizes 10 shapes hierarchically
assert_eq!(bvh.leaf_count(), 10);
assert_eq!(compound.shapes().len(), 10);
// Access the root AABB which bounds all shapes
let root_aabb = bvh.root_aabb();
println!("Root AABB spans from {:?} to {:?}", root_aabb.mins, root_aabb.maxs);Trait Implementations§
Source§impl CompositeShape for Compound
 
impl CompositeShape for Compound
Source§impl PointQuery for Compound
 
impl PointQuery for Compound
Source§fn project_local_point(
    &self,
    point: &Point<f32>,
    solid: bool,
) -> PointProjection
 
fn project_local_point( &self, point: &Point<f32>, solid: bool, ) -> PointProjection
self. Read moreSource§fn project_local_point_and_get_feature(
    &self,
    point: &Point<f32>,
) -> (PointProjection, FeatureId)
 
fn project_local_point_and_get_feature( &self, point: &Point<f32>, ) -> (PointProjection, FeatureId)
self and returns the id of the
feature the point was projected on.Source§fn contains_local_point(&self, point: &Point<f32>) -> bool
 
fn contains_local_point(&self, point: &Point<f32>) -> bool
self.Source§fn project_local_point_with_max_dist(
    &self,
    pt: &Point<f32>,
    solid: bool,
    max_dist: f32,
) -> Option<PointProjection>
 
fn project_local_point_with_max_dist( &self, pt: &Point<f32>, solid: bool, max_dist: f32, ) -> Option<PointProjection>
Source§fn project_point_with_max_dist(
    &self,
    m: &Isometry<f32>,
    pt: &Point<f32>,
    solid: bool,
    max_dist: f32,
) -> Option<PointProjection>
 
fn project_point_with_max_dist( &self, m: &Isometry<f32>, pt: &Point<f32>, solid: bool, max_dist: f32, ) -> Option<PointProjection>
self transformed by m, unless the projection lies further than the given max distance.Source§fn distance_to_local_point(&self, pt: &Point<f32>, solid: bool) -> f32
 
fn distance_to_local_point(&self, pt: &Point<f32>, solid: bool) -> f32
self.Source§fn project_point(
    &self,
    m: &Isometry<f32>,
    pt: &Point<f32>,
    solid: bool,
) -> PointProjection
 
fn project_point( &self, m: &Isometry<f32>, pt: &Point<f32>, solid: bool, ) -> PointProjection
self transformed by m.Source§fn distance_to_point(
    &self,
    m: &Isometry<f32>,
    pt: &Point<f32>,
    solid: bool,
) -> f32
 
fn distance_to_point( &self, m: &Isometry<f32>, pt: &Point<f32>, solid: bool, ) -> f32
self transformed by m.Source§fn project_point_and_get_feature(
    &self,
    m: &Isometry<f32>,
    pt: &Point<f32>,
) -> (PointProjection, FeatureId)
 
fn project_point_and_get_feature( &self, m: &Isometry<f32>, pt: &Point<f32>, ) -> (PointProjection, FeatureId)
self transformed by m and returns the id of the
feature the point was projected on.Source§impl RayCast for Compound
 
impl RayCast for Compound
Source§fn cast_local_ray(
    &self,
    ray: &Ray,
    max_time_of_impact: f32,
    solid: bool,
) -> Option<f32>
 
fn cast_local_ray( &self, ray: &Ray, max_time_of_impact: f32, solid: bool, ) -> Option<f32>
Source§fn cast_local_ray_and_get_normal(
    &self,
    ray: &Ray,
    max_time_of_impact: f32,
    solid: bool,
) -> Option<RayIntersection>
 
fn cast_local_ray_and_get_normal( &self, ray: &Ray, max_time_of_impact: f32, solid: bool, ) -> Option<RayIntersection>
Source§fn intersects_local_ray(&self, ray: &Ray, max_time_of_impact: f32) -> bool
 
fn intersects_local_ray(&self, ray: &Ray, max_time_of_impact: f32) -> bool
Source§fn cast_ray(
    &self,
    m: &Isometry<f32>,
    ray: &Ray,
    max_time_of_impact: f32,
    solid: bool,
) -> Option<f32>
 
fn cast_ray( &self, m: &Isometry<f32>, ray: &Ray, max_time_of_impact: f32, solid: bool, ) -> Option<f32>
Source§fn cast_ray_and_get_normal(
    &self,
    m: &Isometry<f32>,
    ray: &Ray,
    max_time_of_impact: f32,
    solid: bool,
) -> Option<RayIntersection>
 
fn cast_ray_and_get_normal( &self, m: &Isometry<f32>, ray: &Ray, max_time_of_impact: f32, solid: bool, ) -> Option<RayIntersection>
Source§impl Shape for Compound
 
impl Shape for Compound
Source§fn scale_dyn(
    &self,
    scale: &Vector<f32>,
    num_subdivisions: u32,
) -> Option<Box<dyn Shape>>
 
fn scale_dyn( &self, scale: &Vector<f32>, num_subdivisions: u32, ) -> Option<Box<dyn Shape>>
scale into a boxed trait-object. Read moreSource§fn compute_local_aabb(&self) -> Aabb
 
fn compute_local_aabb(&self) -> Aabb
Aabb of this shape.Source§fn compute_local_bounding_sphere(&self) -> BoundingSphere
 
fn compute_local_bounding_sphere(&self) -> BoundingSphere
Source§fn compute_aabb(&self, position: &Isometry<f32>) -> Aabb
 
fn compute_aabb(&self, position: &Isometry<f32>) -> Aabb
Aabb of this shape with the given position.Source§fn mass_properties(&self, density: f32) -> MassProperties
 
fn mass_properties(&self, density: f32) -> MassProperties
Source§fn shape_type(&self) -> ShapeType
 
fn shape_type(&self) -> ShapeType
Source§fn as_typed_shape(&self) -> TypedShape<'_>
 
fn as_typed_shape(&self) -> TypedShape<'_>
fn ccd_thickness(&self) -> f32
fn ccd_angular_thickness(&self) -> f32
fn as_composite_shape(&self) -> Option<&dyn CompositeShape>
Source§fn clone_box(&self) -> Box<dyn Shape>
 
fn clone_box(&self) -> Box<dyn Shape>
clone_dynSource§fn compute_bounding_sphere(&self, position: &Isometry<f32>) -> BoundingSphere
 
fn compute_bounding_sphere(&self, position: &Isometry<f32>) -> BoundingSphere
Source§fn as_support_map(&self) -> Option<&dyn SupportMap>
 
fn as_support_map(&self) -> Option<&dyn SupportMap>
Source§fn as_polygonal_feature_map(&self) -> Option<(&dyn PolygonalFeatureMap, f32)>
 
fn as_polygonal_feature_map(&self) -> Option<(&dyn PolygonalFeatureMap, f32)>
Source§impl TypedCompositeShape for Compound
 
impl TypedCompositeShape for Compound
type PartShape = dyn Shape
type PartNormalConstraints = ()
fn map_typed_part_at<T>( &self, i: u32, f: impl FnMut(Option<&Isometry<f32>>, &Self::PartShape, Option<&Self::PartNormalConstraints>) -> T, ) -> Option<T>
fn map_untyped_part_at<T>( &self, i: u32, f: impl FnMut(Option<&Isometry<f32>>, &Self::PartShape, Option<&dyn NormalConstraints>) -> T, ) -> Option<T>
Auto Trait Implementations§
impl Freeze for Compound
impl !RefUnwindSafe for Compound
impl Send for Compound
impl Sync for Compound
impl Unpin for Compound
impl !UnwindSafe for Compound
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
Source§impl<T> CloneToUninit for Twhere
    T: Clone,
 
impl<T> CloneToUninit for Twhere
    T: Clone,
Source§impl<T> Downcast for Twhere
    T: Any,
 
impl<T> Downcast for Twhere
    T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
 
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
 
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
 
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
 
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
 
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
 
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
 
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
 
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
 
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<SS, SP> SupersetOf<SS> for SPwhere
    SS: SubsetOf<SP>,
 
impl<SS, SP> SupersetOf<SS> for SPwhere
    SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
 
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
 
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
 
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
 
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.