Struct RoundShape

Source
#[repr(C)]
pub struct RoundShape<S> { pub inner_shape: S, pub border_radius: f32, }
Expand description

A shape with rounded borders.

§What is a Rounded Shape?

A RoundShape wraps an existing shape and adds a “border radius” around it. This creates a smooth, rounded version of the original shape by effectively expanding it outward by the border radius distance. Think of it as adding padding or a cushion around the shape.

The rounding is achieved by using Minkowski sum operations: any point on the surface of the rounded shape is computed by taking a point on the original shape’s surface and moving it outward along the surface normal by the border radius distance.

§Common Use Cases

  • Creating softer collisions: Rounded shapes can make collision detection more forgiving and realistic, as sharp corners and edges are smoothed out.
  • Capsule-like shapes: You can create capsule variations of any shape by adding a border radius (e.g., a rounded cuboid becomes similar to a capsule).
  • Visual aesthetics: Rounded shapes often look more pleasing and natural than sharp-edged shapes.
  • Improved numerical stability: Rounded shapes can sometimes be more numerically stable in collision detection algorithms since they avoid sharp corners.

§Examples

§Creating a Rounded Cuboid

use parry3d::shape::{RoundShape, Cuboid};
use parry3d_f64::shape::{RoundShape, Cuboid};
use nalgebra::Vector3;

// Create a cuboid with half-extents of 1.0 in each direction
let cuboid = Cuboid::new(Vector3::new(1.0, 1.0, 1.0));

// Add a border radius of 0.2 to create a rounded cuboid
let rounded_cuboid = RoundShape {
    inner_shape: cuboid,
    border_radius: 0.2,
};

// The effective size is now 1.2 in each direction from the center
// (1.0 from the cuboid + 0.2 from the border)
assert_eq!(rounded_cuboid.inner_shape.half_extents.x, 1.0);
assert_eq!(rounded_cuboid.border_radius, 0.2);

§Creating a Rounded Triangle (2D)

use parry2d::shape::{RoundShape, Triangle};
use parry2d_f64::shape::{RoundShape, Triangle};
use nalgebra::Point2;

// Create a triangle
let triangle = Triangle::new(
    Point2::origin(),
    Point2::new(1.0, 0.0),
    Point2::new(0.0, 1.0),
);

// Add rounding with a 0.1 border radius
let rounded_triangle = RoundShape {
    inner_shape: triangle,
    border_radius: 0.1,
};

// The rounded triangle will have smooth, curved edges instead of sharp corners
assert_eq!(rounded_triangle.border_radius, 0.1);

§Comparing Support Points

This example shows how the border radius affects the support point calculation:

use parry3d::shape::{RoundShape, Cuboid, SupportMap};
use parry3d_f64::shape::{RoundShape, Cuboid, SupportMap};
use nalgebra::Vector3;

let cuboid = Cuboid::new(Vector3::new(1.0, 1.0, 1.0));
let rounded_cuboid = RoundShape {
    inner_shape: cuboid,
    border_radius: 0.5,
};

// Query the support point in the direction (1, 1, 1)
let direction = Vector3::new(1.0, 1.0, 1.0);
let support_point = rounded_cuboid.local_support_point(&direction);

// The support point will be further out than the original cuboid's support point
// due to the border radius
let cuboid_support = cuboid.local_support_point(&direction);

// The rounded shape extends further in all directions
assert!(support_point.x > cuboid_support.x);
assert!(support_point.y > cuboid_support.y);
assert!(support_point.z > cuboid_support.z);

§Using with Different Shape Types

RoundShape can wrap any shape that implements the SupportMap trait:

use parry3d::shape::{RoundShape, Ball, Segment, SupportMap};
use parry3d_f64::shape::{RoundShape, Ball, Segment, SupportMap};
use nalgebra::{Point3, Vector3};

// Rounded ball (creates a slightly larger sphere)
let ball = Ball::new(1.0);
let rounded_ball = RoundShape {
    inner_shape: ball,
    border_radius: 0.1,
};
// Effective radius is now 1.1

// Rounded segment (creates a capsule)
let segment = Segment::new(
    Point3::origin(),
    Point3::new(0.0, 2.0, 0.0),
);
let rounded_segment = RoundShape {
    inner_shape: segment,
    border_radius: 0.5,
};
// This creates a capsule with radius 0.5

§Performance Considerations

  • The computational cost of queries on a RoundShape is essentially the same as for the inner shape, plus a small constant overhead to apply the border radius.
  • RoundShape is most efficient when used with shapes that already implement SupportMap efficiently (like primitives: Ball, Cuboid, Capsule, etc.).
  • The struct is Copy when the inner shape is Copy, making it efficient to pass around.

§Technical Details

The RoundShape implements the SupportMap trait by computing the support point of the inner shape and then offsetting it by the border radius in the query direction. This is mathematically equivalent to computing the Minkowski sum of the inner shape with a ball of radius equal to the border radius.

Fields§

§inner_shape: S

The shape being rounded.

This is the original, “inner” shape before the border radius is applied. The rounded shape’s surface will be at a distance of border_radius from this inner shape’s surface.

§border_radius: f32

The radius of the rounded border.

This value determines how much the shape is expanded outward. A larger border radius creates a more “padded” shape. Must be non-negative (typically positive).

For example, if border_radius is 0.5, every point on the original shape’s surface will be moved 0.5 units outward along its surface normal.

Implementations§

Source§

impl RoundShape<Cone>

Source

pub fn to_outline( &self, nsubdiv: u32, border_nsubdiv: u32, ) -> (Vec<Point3<f32>>, Vec<[u32; 2]>)

Outlines this round cone’s shape using polylines.

Source§

impl RoundShape<ConvexPolyhedron>

Source

pub fn to_outline(&self, nsubdivs: u32) -> (Vec<Point3<f32>>, Vec<[u32; 2]>)

Outlines this round convex polyhedron’s shape using polylines.

Source§

impl RoundShape<Cuboid>

Source

pub fn to_outline(&self, nsubdivs: u32) -> (Vec<Point<f32>>, Vec<[u32; 2]>)

Outlines this round cuboid’s surface with polylines.

Source§

impl RoundShape<Cylinder>

Source

pub fn to_outline( &self, nsubdiv: u32, border_nsubdiv: u32, ) -> (Vec<Point3<f32>>, Vec<[u32; 2]>)

Outlines this round cylinder’s shape using polylines.

Trait Implementations§

Source§

impl<S: Clone> Clone for RoundShape<S>

Source§

fn clone(&self) -> RoundShape<S>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<S: Debug> Debug for RoundShape<S>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<S: SupportMap> PointQuery for RoundShape<S>

Source§

fn project_local_point( &self, point: &Point<f32>, solid: bool, ) -> PointProjection

Projects a point on self. Read more
Source§

fn project_local_point_and_get_feature( &self, point: &Point<f32>, ) -> (PointProjection, FeatureId)

Projects a point on the boundary of self and returns the id of the feature the point was projected on.
Source§

fn project_local_point_with_max_dist( &self, pt: &Point<f32>, solid: bool, max_dist: f32, ) -> Option<PointProjection>

Projects a point onto the shape, with a maximum distance limit. Read more
Source§

fn project_point_with_max_dist( &self, m: &Isometry<f32>, pt: &Point<f32>, solid: bool, max_dist: f32, ) -> Option<PointProjection>

Projects a point on 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

Computes the minimal distance between a point and self.
Source§

fn contains_local_point(&self, pt: &Point<f32>) -> bool

Tests if the given point is inside of self.
Source§

fn project_point( &self, m: &Isometry<f32>, pt: &Point<f32>, solid: bool, ) -> PointProjection

Projects a point on self transformed by m.
Source§

fn distance_to_point( &self, m: &Isometry<f32>, pt: &Point<f32>, solid: bool, ) -> f32

Computes the minimal distance between a point and self transformed by m.
Source§

fn project_point_and_get_feature( &self, m: &Isometry<f32>, pt: &Point<f32>, ) -> (PointProjection, FeatureId)

Projects a point on the boundary of self transformed by m and returns the id of the feature the point was projected on.
Source§

fn contains_point(&self, m: &Isometry<f32>, pt: &Point<f32>) -> bool

Tests if the given point is inside of self transformed by m.
Source§

impl<S: SupportMap> RayCast for RoundShape<S>

Source§

fn cast_local_ray_and_get_normal( &self, ray: &Ray, max_time_of_impact: f32, solid: bool, ) -> Option<RayIntersection>

Computes the time of impact, and normal between this transformed shape and a ray.
Source§

fn cast_local_ray( &self, ray: &Ray, max_time_of_impact: f32, solid: bool, ) -> Option<f32>

Computes the time of impact between this transform shape and a ray.
Source§

fn intersects_local_ray(&self, ray: &Ray, max_time_of_impact: f32) -> bool

Tests whether a ray intersects this transformed shape.
Source§

fn cast_ray( &self, m: &Isometry<f32>, ray: &Ray, max_time_of_impact: f32, solid: bool, ) -> Option<f32>

Computes the time of impact between this transform shape and a ray.
Source§

fn cast_ray_and_get_normal( &self, m: &Isometry<f32>, ray: &Ray, max_time_of_impact: f32, solid: bool, ) -> Option<RayIntersection>

Computes the time of impact, and normal between this transformed shape and a ray.
Source§

fn intersects_ray( &self, m: &Isometry<f32>, ray: &Ray, max_time_of_impact: f32, ) -> bool

Tests whether a ray intersects this transformed shape.
Source§

impl Shape for RoundShape<Cone>

Source§

fn clone_dyn(&self) -> Box<dyn Shape>

Clones this shape into a boxed trait-object. Read more
Source§

fn scale_dyn( &self, scale: &Vector<f32>, num_subdivisions: u32, ) -> Option<Box<dyn Shape>>

Scales this shape by scale into a boxed trait-object. Read more
Source§

fn compute_local_aabb(&self) -> Aabb

Computes the Aabb of this shape.
Source§

fn compute_local_bounding_sphere(&self) -> BoundingSphere

Computes the bounding-sphere of this shape.
Source§

fn compute_aabb(&self, position: &Isometry<f32>) -> Aabb

Computes the Aabb of this shape with the given position.
Source§

fn mass_properties(&self, density: f32) -> MassProperties

Compute the mass-properties of this shape given its uniform density.
Source§

fn is_convex(&self) -> bool

Is this shape known to be convex? Read more
Source§

fn shape_type(&self) -> ShapeType

Gets the type tag of this shape.
Source§

fn as_typed_shape(&self) -> TypedShape<'_>

Gets the underlying shape as an enum.
Source§

fn ccd_thickness(&self) -> f32

Source§

fn ccd_angular_thickness(&self) -> f32

Source§

fn as_support_map(&self) -> Option<&dyn SupportMap>

Converts this shape into its support mapping, if it has one.
Source§

fn as_polygonal_feature_map(&self) -> Option<(&dyn PolygonalFeatureMap, f32)>

Converts this shape to a polygonal feature-map, if it is one.
Source§

fn clone_box(&self) -> Box<dyn Shape>

👎Deprecated: renamed to clone_dyn
Clones this shape into a boxed trait-object. Read more
Source§

fn compute_bounding_sphere(&self, position: &Isometry<f32>) -> BoundingSphere

Computes the bounding-sphere of this shape with the given position.
Source§

fn as_composite_shape(&self) -> Option<&dyn CompositeShape>

Source§

fn feature_normal_at_point( &self, _feature: FeatureId, _point: &Point<f32>, ) -> Option<Unit<Vector<f32>>>

The shape’s normal at the given point located on a specific feature.
Source§

fn compute_swept_aabb( &self, start_pos: &Isometry<f32>, end_pos: &Isometry<f32>, ) -> Aabb

Computes the swept Aabb of this shape, i.e., the space it would occupy by moving from the given start position to the given end position.
Source§

impl Shape for RoundShape<ConvexPolyhedron>

Source§

fn clone_dyn(&self) -> Box<dyn Shape>

Clones this shape into a boxed trait-object. Read more
Source§

fn scale_dyn( &self, scale: &Vector<f32>, num_subdivisions: u32, ) -> Option<Box<dyn Shape>>

Scales this shape by scale into a boxed trait-object. Read more
Source§

fn compute_local_aabb(&self) -> Aabb

Computes the Aabb of this shape.
Source§

fn compute_local_bounding_sphere(&self) -> BoundingSphere

Computes the bounding-sphere of this shape.
Source§

fn compute_aabb(&self, position: &Isometry<f32>) -> Aabb

Computes the Aabb of this shape with the given position.
Source§

fn mass_properties(&self, density: f32) -> MassProperties

Compute the mass-properties of this shape given its uniform density.
Source§

fn is_convex(&self) -> bool

Is this shape known to be convex? Read more
Source§

fn shape_type(&self) -> ShapeType

Gets the type tag of this shape.
Source§

fn as_typed_shape(&self) -> TypedShape<'_>

Gets the underlying shape as an enum.
Source§

fn ccd_thickness(&self) -> f32

Source§

fn ccd_angular_thickness(&self) -> f32

Source§

fn as_support_map(&self) -> Option<&dyn SupportMap>

Converts this shape into its support mapping, if it has one.
Source§

fn as_polygonal_feature_map(&self) -> Option<(&dyn PolygonalFeatureMap, f32)>

Converts this shape to a polygonal feature-map, if it is one.
Source§

fn clone_box(&self) -> Box<dyn Shape>

👎Deprecated: renamed to clone_dyn
Clones this shape into a boxed trait-object. Read more
Source§

fn compute_bounding_sphere(&self, position: &Isometry<f32>) -> BoundingSphere

Computes the bounding-sphere of this shape with the given position.
Source§

fn as_composite_shape(&self) -> Option<&dyn CompositeShape>

Source§

fn feature_normal_at_point( &self, _feature: FeatureId, _point: &Point<f32>, ) -> Option<Unit<Vector<f32>>>

The shape’s normal at the given point located on a specific feature.
Source§

fn compute_swept_aabb( &self, start_pos: &Isometry<f32>, end_pos: &Isometry<f32>, ) -> Aabb

Computes the swept Aabb of this shape, i.e., the space it would occupy by moving from the given start position to the given end position.
Source§

impl Shape for RoundShape<Cuboid>

Source§

fn clone_dyn(&self) -> Box<dyn Shape>

Clones this shape into a boxed trait-object. Read more
Source§

fn scale_dyn( &self, scale: &Vector<f32>, num_subdivisions: u32, ) -> Option<Box<dyn Shape>>

Scales this shape by scale into a boxed trait-object. Read more
Source§

fn compute_local_aabb(&self) -> Aabb

Computes the Aabb of this shape.
Source§

fn compute_local_bounding_sphere(&self) -> BoundingSphere

Computes the bounding-sphere of this shape.
Source§

fn compute_aabb(&self, position: &Isometry<f32>) -> Aabb

Computes the Aabb of this shape with the given position.
Source§

fn mass_properties(&self, density: f32) -> MassProperties

Compute the mass-properties of this shape given its uniform density.
Source§

fn is_convex(&self) -> bool

Is this shape known to be convex? Read more
Source§

fn shape_type(&self) -> ShapeType

Gets the type tag of this shape.
Source§

fn as_typed_shape(&self) -> TypedShape<'_>

Gets the underlying shape as an enum.
Source§

fn ccd_thickness(&self) -> f32

Source§

fn ccd_angular_thickness(&self) -> f32

Source§

fn as_support_map(&self) -> Option<&dyn SupportMap>

Converts this shape into its support mapping, if it has one.
Source§

fn as_polygonal_feature_map(&self) -> Option<(&dyn PolygonalFeatureMap, f32)>

Converts this shape to a polygonal feature-map, if it is one.
Source§

fn clone_box(&self) -> Box<dyn Shape>

👎Deprecated: renamed to clone_dyn
Clones this shape into a boxed trait-object. Read more
Source§

fn compute_bounding_sphere(&self, position: &Isometry<f32>) -> BoundingSphere

Computes the bounding-sphere of this shape with the given position.
Source§

fn as_composite_shape(&self) -> Option<&dyn CompositeShape>

Source§

fn feature_normal_at_point( &self, _feature: FeatureId, _point: &Point<f32>, ) -> Option<Unit<Vector<f32>>>

The shape’s normal at the given point located on a specific feature.
Source§

fn compute_swept_aabb( &self, start_pos: &Isometry<f32>, end_pos: &Isometry<f32>, ) -> Aabb

Computes the swept Aabb of this shape, i.e., the space it would occupy by moving from the given start position to the given end position.
Source§

impl Shape for RoundShape<Cylinder>

Source§

fn clone_dyn(&self) -> Box<dyn Shape>

Clones this shape into a boxed trait-object. Read more
Source§

fn scale_dyn( &self, scale: &Vector<f32>, num_subdivisions: u32, ) -> Option<Box<dyn Shape>>

Scales this shape by scale into a boxed trait-object. Read more
Source§

fn compute_local_aabb(&self) -> Aabb

Computes the Aabb of this shape.
Source§

fn compute_local_bounding_sphere(&self) -> BoundingSphere

Computes the bounding-sphere of this shape.
Source§

fn compute_aabb(&self, position: &Isometry<f32>) -> Aabb

Computes the Aabb of this shape with the given position.
Source§

fn mass_properties(&self, density: f32) -> MassProperties

Compute the mass-properties of this shape given its uniform density.
Source§

fn is_convex(&self) -> bool

Is this shape known to be convex? Read more
Source§

fn shape_type(&self) -> ShapeType

Gets the type tag of this shape.
Source§

fn as_typed_shape(&self) -> TypedShape<'_>

Gets the underlying shape as an enum.
Source§

fn ccd_thickness(&self) -> f32

Source§

fn ccd_angular_thickness(&self) -> f32

Source§

fn as_support_map(&self) -> Option<&dyn SupportMap>

Converts this shape into its support mapping, if it has one.
Source§

fn as_polygonal_feature_map(&self) -> Option<(&dyn PolygonalFeatureMap, f32)>

Converts this shape to a polygonal feature-map, if it is one.
Source§

fn clone_box(&self) -> Box<dyn Shape>

👎Deprecated: renamed to clone_dyn
Clones this shape into a boxed trait-object. Read more
Source§

fn compute_bounding_sphere(&self, position: &Isometry<f32>) -> BoundingSphere

Computes the bounding-sphere of this shape with the given position.
Source§

fn as_composite_shape(&self) -> Option<&dyn CompositeShape>

Source§

fn feature_normal_at_point( &self, _feature: FeatureId, _point: &Point<f32>, ) -> Option<Unit<Vector<f32>>>

The shape’s normal at the given point located on a specific feature.
Source§

fn compute_swept_aabb( &self, start_pos: &Isometry<f32>, end_pos: &Isometry<f32>, ) -> Aabb

Computes the swept Aabb of this shape, i.e., the space it would occupy by moving from the given start position to the given end position.
Source§

impl Shape for RoundShape<Triangle>

Source§

fn clone_dyn(&self) -> Box<dyn Shape>

Clones this shape into a boxed trait-object. Read more
Source§

fn scale_dyn( &self, scale: &Vector<f32>, num_subdivisions: u32, ) -> Option<Box<dyn Shape>>

Scales this shape by scale into a boxed trait-object. Read more
Source§

fn compute_local_aabb(&self) -> Aabb

Computes the Aabb of this shape.
Source§

fn compute_local_bounding_sphere(&self) -> BoundingSphere

Computes the bounding-sphere of this shape.
Source§

fn compute_aabb(&self, position: &Isometry<f32>) -> Aabb

Computes the Aabb of this shape with the given position.
Source§

fn mass_properties(&self, density: f32) -> MassProperties

Compute the mass-properties of this shape given its uniform density.
Source§

fn is_convex(&self) -> bool

Is this shape known to be convex? Read more
Source§

fn shape_type(&self) -> ShapeType

Gets the type tag of this shape.
Source§

fn as_typed_shape(&self) -> TypedShape<'_>

Gets the underlying shape as an enum.
Source§

fn ccd_thickness(&self) -> f32

Source§

fn ccd_angular_thickness(&self) -> f32

Source§

fn as_support_map(&self) -> Option<&dyn SupportMap>

Converts this shape into its support mapping, if it has one.
Source§

fn as_polygonal_feature_map(&self) -> Option<(&dyn PolygonalFeatureMap, f32)>

Converts this shape to a polygonal feature-map, if it is one.
Source§

fn clone_box(&self) -> Box<dyn Shape>

👎Deprecated: renamed to clone_dyn
Clones this shape into a boxed trait-object. Read more
Source§

fn compute_bounding_sphere(&self, position: &Isometry<f32>) -> BoundingSphere

Computes the bounding-sphere of this shape with the given position.
Source§

fn as_composite_shape(&self) -> Option<&dyn CompositeShape>

Source§

fn feature_normal_at_point( &self, _feature: FeatureId, _point: &Point<f32>, ) -> Option<Unit<Vector<f32>>>

The shape’s normal at the given point located on a specific feature.
Source§

fn compute_swept_aabb( &self, start_pos: &Isometry<f32>, end_pos: &Isometry<f32>, ) -> Aabb

Computes the swept Aabb of this shape, i.e., the space it would occupy by moving from the given start position to the given end position.
Source§

impl<S: SupportMap> SupportMap for RoundShape<S>

Source§

fn local_support_point(&self, dir: &Vector<f32>) -> Point<f32>

Computes the support point of the rounded shape in the given direction.

The support point is the point on the shape’s surface that is furthest in the given direction. For a rounded shape, this is computed by:

  1. Finding the support point of the inner shape in the given direction
  2. Moving that point outward by border_radius units along the direction
§Parameters
  • dir - The direction vector (will be normalized internally)
§Returns

The point on the rounded shape’s surface that is furthest in the given direction.

§Examples
use parry3d::shape::{RoundShape, Cuboid, SupportMap};
use parry3d_f64::shape::{RoundShape, Cuboid, SupportMap};
use nalgebra::Vector3;

let cuboid = Cuboid::new(Vector3::new(1.0, 1.0, 1.0));
let rounded = RoundShape {
    inner_shape: cuboid,
    border_radius: 0.5,
};

// Support point in the positive X direction
let dir = Vector3::new(1.0, 0.0, 0.0);
let support = rounded.local_support_point(&dir);

// The X coordinate is the cuboid's half-extent plus the border radius
assert!((support.x - 1.5).abs() < 1e-6);
Source§

fn local_support_point_toward(&self, dir: &Unit<Vector<f32>>) -> Point<f32>

Computes the support point of the rounded shape toward the given unit direction.

This is similar to local_support_point but takes a pre-normalized direction vector, which can be more efficient when the direction is already normalized.

The implementation adds the border radius offset to the inner shape’s support point: support_point = inner_support_point + direction * border_radius

§Parameters
  • dir - A unit-length direction vector
§Returns

The point on the rounded shape’s surface that is furthest in the given direction.

§Examples
use parry2d::shape::{RoundShape, Ball, SupportMap};
use parry2d_f64::shape::{RoundShape, Ball, SupportMap};
use nalgebra::{Vector2, Unit};

let ball = Ball::new(1.0);
let rounded = RoundShape {
    inner_shape: ball,
    border_radius: 0.3,
};

// Create a unit direction
let dir = Unit::new_normalize(Vector2::new(1.0, 1.0));
let support = rounded.local_support_point_toward(&dir);

// The distance from origin should be ball radius + border radius
let distance = (support.x.powi(2) + support.y.powi(2)).sqrt();
assert!((distance - 1.3).abs() < 1e-6);
Source§

fn support_point( &self, transform: &Isometry<f32>, dir: &Vector<f32>, ) -> Point<f32>

Evaluates the support function of this shape transformed by transform. Read more
Source§

fn support_point_toward( &self, transform: &Isometry<f32>, dir: &Unit<Vector<f32>>, ) -> Point<f32>

Same as support_point except that dir is guaranteed to be normalized (unit length). Read more
Source§

impl<S: Copy> Copy for RoundShape<S>

Auto Trait Implementations§

§

impl<S> Freeze for RoundShape<S>
where S: Freeze,

§

impl<S> RefUnwindSafe for RoundShape<S>
where S: RefUnwindSafe,

§

impl<S> Send for RoundShape<S>
where S: Send,

§

impl<S> Sync for RoundShape<S>
where S: Sync,

§

impl<S> Unpin for RoundShape<S>
where S: Unpin,

§

impl<S> UnwindSafe for RoundShape<S>
where S: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts 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>

Converts 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)

Converts &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)

Converts &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
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Sync + Send>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.