Rect

Struct Rect 

Source
#[repr(C)]
pub struct Rect<T> { pub x: T, pub y: T, pub w: T, pub h: T, }
Expand description

A 2D axis-aligned rectangle.

Most of the methods for this struct assume that the rectangle has a positive width and height, so rectangles where T is signed may yield incorrect values for negative-sized instances.

Fields§

§x: T§y: T§w: T§h: T

Implementations§

Source§

impl<T: Copy + AbsDiffEq<Epsilon = T>> Rect<T>

Source

pub fn abs_diff_eq(&self, other: &Self) -> bool

Returns true if the two values are approximately equal according to the absolute difference between their components.

Source§

impl<T: Copy + RelativeEq<Epsilon = T>> Rect<T>

Source

pub fn relative_eq(&self, other: &Self) -> bool

Returns true if the two values are approximately equal according to the absolute difference between their components, as well as relative-based comparisons.

Source§

impl<T: Copy + UlpsEq<Epsilon = T>> Rect<T>

Source

pub fn ulps_eq(&self, other: &Self) -> bool

Returns true if the two values are approximately equal according to the absolute difference between their components, as well as ULPs (Units in Last Place).

Source§

impl<T: Pod + NoUninit> Rect<T>

Source

pub fn as_bytes(&self) -> &[u8]

This type re-interpreted as a slice of bytes.

Source

pub fn as_bytes_mut(&mut self) -> &mut [u8]

This type re-interpreted as a mutable slice of bytes.

Source§

impl<T> Rect<T>

Source

pub const fn new(x: T, y: T, w: T, h: T) -> Self

Create a new rectangle.

Source

pub fn map<U, F: FnMut(T) -> U>(self, f: F) -> Rect<U>

Map the rectangle from one type to another.

Source§

impl<T: Copy> Rect<T>

Source

pub fn size(&self) -> Vec2<T>

The width and height of the rectangle.

Source

pub fn left(&self) -> T

The left edge of the rectangle. Equivalent to x.

Source

pub fn top(&self) -> T

The top edge of the rectangle. Equivalent to y.

Source

pub fn top_left(&self) -> Vec2<T>

The top-left point of the rectangle.

Source§

impl<T: Num> Rect<T>

Source

pub const ZERO: Self

A zero-sized rectangle.

Source

pub const fn sized(size: Vec2<T>) -> Self

A rectangle at (0, 0) with the provided width and height.

Source

pub const fn pos_size(pos: Vec2<T>, size: Vec2<T>) -> Self

A rectangle at pos with the size.

Source

pub fn right(&self) -> T

Right edge of the rectangle. Equivalent to x + w.

Source

pub fn bottom(&self) -> T

Bottom edge of the rectangle. Equivalent to y + h.

Source

pub fn top_right(&self) -> Vec2<T>

Top-right point of the rectangle.

Source

pub fn bottom_right(&self) -> Vec2<T>

Bottom-right point of the rectangle.

Source

pub fn bottom_left(&self) -> Vec2<T>

Bottom-left point of the rectangle.

Source

pub fn center_x(&self) -> T

Center x-position of the rectangle.

Source

pub fn center_y(&self) -> T

Cente y-position of the rectangle.

Source

pub fn center(&self) -> Vec2<T>

Center point of the rectangle.

Source

pub fn top_center(&self) -> Vec2<T>

Center point along the rectangle’s top edge.

Source

pub fn bottom_center(&self) -> Vec2<T>

Center point along the rectangle’s bottom edge.

Source

pub fn right_center(&self) -> Vec2<T>

Center point along the rectangle’s right edge.

Source

pub fn left_center(&self) -> Vec2<T>

Center point along the rectangle’s left edge.

Source

pub fn area(&self) -> T

Area of the rectangle.

Source

pub fn perimeter(&self) -> T

Length of the rectangle’s perimeter.

Source

pub fn contains(&self, p: Vec2<T>) -> bool

Returns true if this rectangle contains the point.

Source

pub fn translate(&self, amount: &Vec2<T>) -> Self

Translate the rectangle.

Source

pub fn top_edge(&self) -> Line<T>

Top edge segment of the rectangle.

Source

pub fn right_edge(&self) -> Line<T>

Right edge segment of the rectangle.

Source

pub fn bottom_edge(&self) -> Line<T>

Bottom edge segment of the rectangle.

Source

pub fn left_edge(&self) -> Line<T>

Left edge segment of the rectangle.

Source

pub fn corners(&self) -> [Vec2<T>; 4]

The rectangle’s 4 corner points.

Source

pub fn edges(&self) -> [Line<T>; 4]

The rectangle’s 4 edges.

Source

pub fn inflate(self, amount: impl Into<Vec2<T>>) -> Self

Inflate the rectangle by the amount.

Source

pub fn min_x(&self) -> T

Absolute left bounds of the rectangle.

Source

pub fn min_y(&self) -> T

Absolute top bounds of the rectangle.

Source

pub fn max_x(&self) -> T

Absolute right bounds of the rectangle.

Source

pub fn max_y(&self) -> T

Absolute bottom bounds of the rectangle.

Source

pub fn min_pos(&self) -> Vec2<T>

Absolute top-left point of the rectangle.

Source

pub fn max_pos(&self) -> Vec2<T>

Absolute bottom-right point of the rectangle.

Source

pub fn contains_rect(&self, r: &Self) -> bool

If this rectangle contains the other.

Source

pub fn overlaps(&self, r: &Self) -> bool

If this rectangle overlaps the other.

Source

pub fn overlap(&self, r: &Self) -> Option<Self>

If this rectangle overlaps the other, returns a rectangle representing the overlapping region.

Source

pub fn conflate(&self, r: &Self) -> Self

Return a rectangle that minimally encapsulates this rectangle and the other. This is useful if you have a lot of rectangles (or bounds) and want to find the minimal sum boundary that contains them all.

Source

pub fn clamp_inside(&self, outer: &Self) -> Self

Return a rectangle that is this rectangle clamped inside of the provided outer rectangle. If this rectangle is larger than the outer by either dimension, it will be shrunk to fit.

Source§

impl<T: Signed> Rect<T>

Source

pub fn is_positive(&self) -> bool

If the rectangle has a non-negative size.

Source

pub fn non_neg(self) -> Self

If the rectangle has a negative width or height, invert it on those axes and return a corrected version with non-negative dimensions

Source§

impl<T: Float> Rect<T>

Source

pub fn transform_by(&self, f: impl FnMut(Vec2<T>) -> Vec2<T>) -> Quad<T>

Transform the rectangle, producing a quad.

Source

pub fn transform_by_retain(&self, f: impl FnMut(Vec2<T>) -> Vec2<T>) -> Rect<T>

Transform the rectangle, but retain the type.

Source§

impl<T: Float> Rect<T>

Source

pub fn fitted(&self, size: Vec2<T>, fractional: bool) -> (Self, T)

Source

pub fn map_pos(&self, pos: Vec2<T>, target: &Rect<T>) -> Vec2<T>

Trait Implementations§

Source§

impl<T> AbsDiffEq for Rect<T>
where T: AbsDiffEq, T::Epsilon: Copy,

Source§

type Epsilon = <T as AbsDiffEq>::Epsilon

Used for specifying relative comparisons.
Source§

fn default_epsilon() -> Self::Epsilon

The default tolerance to use when testing values that are close together. Read more
Source§

fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool

A test for equality that uses the absolute difference to compute the approximate equality of two numbers.
Source§

fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool

The inverse of AbsDiffEq::abs_diff_eq.
Source§

impl<T: Copy + Add<T, Output = T>> Add<&Vec2<T>> for &Rect<T>

Source§

type Output = Rect<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Vec2<T>) -> Self::Output

Performs the + operation. Read more
Source§

impl<T: Copy + Add<T, Output = T>> Add<&Vec2<T>> for Rect<T>

Source§

type Output = Rect<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Vec2<T>) -> Self::Output

Performs the + operation. Read more
Source§

impl<T: Copy + Add<T, Output = T>> Add<Vec2<T>> for &Rect<T>

Source§

type Output = Rect<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Vec2<T>) -> Self::Output

Performs the + operation. Read more
Source§

impl<T: Add<T, Output = T>> Add<Vec2<T>> for Rect<T>

Source§

type Output = Rect<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Vec2<T>) -> Self::Output

Performs the + operation. Read more
Source§

impl<T: Copy + AddAssign<T>> AddAssign<&Vec2<T>> for Rect<T>

Source§

fn add_assign(&mut self, rhs: &Vec2<T>)

Performs the += operation. Read more
Source§

impl<T: AddAssign<T>> AddAssign<Vec2<T>> for Rect<T>

Source§

fn add_assign(&mut self, rhs: Vec2<T>)

Performs the += operation. Read more
Source§

impl<T: Clone> Clone for Rect<T>

Source§

fn clone(&self) -> Rect<T>

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<T: Debug> Debug for Rect<T>

Source§

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

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

impl<T: Default> Default for Rect<T>

Source§

fn default() -> Rect<T>

Returns the “default value” for a type. Read more
Source§

impl<'de, T: Deserialize<'de>> Deserialize<'de> for Rect<T>

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<T: Display> Display for Rect<T>

Source§

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

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

impl<T: Num> Div<T> for &Rect<T>

Source§

type Output = Rect<T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: T) -> Self::Output

Performs the / operation. Read more
Source§

impl<T: Num> Div<T> for Rect<T>

Source§

type Output = Rect<T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: T) -> Self::Output

Performs the / operation. Read more
Source§

impl<T: Num> Div<Vec2<T>> for &Rect<T>

Source§

type Output = Rect<T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Vec2<T>) -> Self::Output

Performs the / operation. Read more
Source§

impl<T: Num> Div<Vec2<T>> for Rect<T>

Source§

type Output = Rect<T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Vec2<T>) -> Self::Output

Performs the / operation. Read more
Source§

impl<T: Num> DivAssign<T> for Rect<T>

Source§

fn div_assign(&mut self, rhs: T)

Performs the /= operation. Read more
Source§

impl<T> From<[T; 4]> for Rect<T>

Source§

fn from([x, y, w, h]: [T; 4]) -> Self

Converts to this type from the input type.
Source§

impl<T> From<(T, T, T, T)> for Rect<T>

Source§

fn from((x, y, w, h): (T, T, T, T)) -> Self

Converts to this type from the input type.
Source§

impl<T> From<Rect<T>> for [T; 4]

Source§

fn from(_: Rect<T>) -> [T; 4]

Converts to this type from the input type.
Source§

impl<T> From<Rect<T>> for (T, T, T, T)

Source§

fn from(_: Rect<T>) -> (T, T, T, T)

Converts to this type from the input type.
Source§

impl<T> From<Rect<T>> for DynShape<T>

Source§

fn from(value: Rect<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: Num> From<Rect<T>> for Polygon<T>

Source§

fn from(value: Rect<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: Num> From<Rect<T>> for Quad<T>

Source§

fn from(value: Rect<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: Hash> Hash for Rect<T>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T: Float + Interp<Factor = T>> Interp for Rect<T>

Source§

type Factor = T

The factor by which this type is interpolated.
Source§

fn lerp(self, target: Self, t: Self::Factor) -> Self

Linear interpolation.
Source§

fn quad_bezier(self, control: Self, target: Self, t: Self::Factor) -> Self

Quadratic bezier interpolation.
Source§

fn cubic_bezier( self, control1: Self, control2: Self, target: Self, t: Self::Factor, ) -> Self

Cubic bezier interpolation.
Source§

fn hermite( self, tangent1: Self::Factor, target: Self, tangent2: Self::Factor, t: Self::Factor, ) -> Self

Cubic Hermite interpolation. Read more
Source§

fn catmull_rom( self, control1: Self, control2: Self, target: Self, t: Self::Factor, ) -> Self

Catmull-Rom interpolation. Read more
Source§

fn smooth_step(self, target: Self, t: Self::Factor) -> Self

Smooth-step interpolation. Read more
Source§

impl<T: Num> Mul<T> for &Rect<T>

Source§

type Output = Rect<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: T) -> Self::Output

Performs the * operation. Read more
Source§

impl<T: Num> Mul<T> for Rect<T>

Source§

type Output = Rect<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: T) -> Self::Output

Performs the * operation. Read more
Source§

impl<T: Num> Mul<Vec2<T>> for &Rect<T>

Source§

type Output = Rect<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Vec2<T>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T: Num> Mul<Vec2<T>> for Rect<T>

Source§

type Output = Rect<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Vec2<T>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T: Num> MulAssign<T> for Rect<T>

Source§

fn mul_assign(&mut self, rhs: T)

Performs the *= operation. Read more
Source§

impl<T: Numeric<AsU8 = u8, AsU16 = u16, AsU32 = u32, AsU64 = u64, AsU128 = u128, AsUSize = usize, AsI8 = i8, AsI16 = i16, AsI32 = i32, AsI64 = i64, AsI128 = i128, AsISize = isize, AsF32 = f32, AsF64 = f64>> Numeric for Rect<T>

Source§

impl<T: Ord> Ord for Rect<T>

Source§

fn cmp(&self, other: &Rect<T>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<T: PartialEq> PartialEq for Rect<T>

Source§

fn eq(&self, other: &Rect<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: PartialOrd> PartialOrd for Rect<T>

Source§

fn partial_cmp(&self, other: &Rect<T>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<T: Float> Polygonal<T> for Rect<T>

Source§

fn nearest_vertex(&self, source: Vec2<T>) -> Vec2<T>

Get the nearest point on this polygon to the source point.
Source§

fn all_edges<F: FnMut(Line<T>) -> bool>(&self, cond: F) -> bool

Iterate all polygonal edges of the shape, returning true if any of them satisfy the conditional function provided.
Source§

fn all_normals<F: FnMut(Vec2<T>) -> bool>(&self, cond: F) -> bool

Iterate all edge normals of the shape, returning true if any of them satisfy the conditional function provided.
Source§

fn visit_normals<F: FnMut(Vec2<T>)>(&self, plot: F)

Walk through every normal of the polygon.
Source§

fn visit_edges<F: FnMut(Line<T>)>(&self, plot: F)

Walk through every edge of the polygon.
Source§

impl<T> RelativeEq for Rect<T>
where T: RelativeEq, T::Epsilon: Copy,

Source§

fn default_max_relative() -> Self::Epsilon

The default relative tolerance for testing values that are far-apart. Read more
Source§

fn relative_eq( &self, other: &Self, epsilon: Self::Epsilon, max_relative: Self::Epsilon, ) -> bool

A test for equality that uses a relative comparison if the values are far apart.
Source§

fn relative_ne( &self, other: &Rhs, epsilon: Self::Epsilon, max_relative: Self::Epsilon, ) -> bool

The inverse of RelativeEq::relative_eq.
Source§

impl<T: Num> Rem<T> for &Rect<T>

Source§

type Output = Rect<T>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: T) -> Self::Output

Performs the % operation. Read more
Source§

impl<T: Num> Rem<T> for Rect<T>

Source§

type Output = Rect<T>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: T) -> Self::Output

Performs the % operation. Read more
Source§

impl<T: Num> Rem<Vec2<T>> for &Rect<T>

Source§

type Output = Rect<T>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Vec2<T>) -> Self::Output

Performs the % operation. Read more
Source§

impl<T: Num> Rem<Vec2<T>> for Rect<T>

Source§

type Output = Rect<T>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Vec2<T>) -> Self::Output

Performs the % operation. Read more
Source§

impl<T: Num> RemAssign<T> for Rect<T>

Source§

fn rem_assign(&mut self, rhs: T)

Performs the %= operation. Read more
Source§

impl<T: Serialize> Serialize for Rect<T>

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<T: Float> Shape<T> for Rect<T>

Source§

fn centroid(&self) -> Vec2<T>

Centroid of the shape.
Source§

fn contains(&self, p: Vec2<T>) -> bool

If the point is contained within the shape.
Source§

fn bounds(&self) -> Rect<T>

Rectangular bounds of the shape.
Source§

fn project_onto_axis(&self, axis: Vec2<T>) -> Projection<T>

Project the shape onto the axis.
Source§

fn project_point(&self, p: Vec2<T>) -> Vec2<T>

Project a point onto the outside surface of the shape.
Source§

fn rayhit(&self, ray: &Ray<T>) -> bool

Check if a ray intersects this shape.
Source§

fn raycast(&self, ray: &Ray<T>) -> Option<RayHit<T>>

Raycast against the shape.
Source§

fn overlaps_rect(&self, rect: &Rect<T>) -> bool

If this shape overlaps the rectangle.
Source§

fn overlaps_circ(&self, circ: &Circle<T>) -> bool

If this shape overlaps the circle.
Source§

fn overlaps_poly<P: Polygonal<T>>(&self, poly: &P) -> bool

If this shape overlaps the polygon.
Source§

fn extract_from_circ(&self, circ: &Circle<T>) -> Option<Vec2<T>>

If this shape and the circle overlap, return a push-out vector that can be used to extract them from each other.
Source§

fn extract_from_poly<P: Polygonal<T>>(&self, poly: &P) -> Option<Vec2<T>>

If this shape and the polygon overlap, return a push-out vector that can be used to extract them from each other.
Source§

fn is_convex(&self) -> bool

If this shape is convex.
Source§

impl<T: Float + SmoothInterp<Factor = T>> SmoothInterp for Rect<T>

Source§

fn smooth_damp( &mut self, velocity: &mut Self, target: Self, smooth_time: Self::Factor, max_speed: Self::Factor, delta_time: Self::Factor, )

Accelerate towards a target with stateful velocity.
Source§

fn smooth_lerp(self, target: Self, t: Self::Factor, dt: Self::Factor) -> Self

Lerp towards a target with a framerate-invariant version. Read more
Source§

impl<T: Copy + Sub<T, Output = T>> Sub<&Vec2<T>> for &Rect<T>

Source§

type Output = Rect<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &Vec2<T>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T: Copy + Sub<T, Output = T>> Sub<&Vec2<T>> for Rect<T>

Source§

type Output = Rect<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &Vec2<T>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T: Copy + Sub<T, Output = T>> Sub<Vec2<T>> for &Rect<T>

Source§

type Output = Rect<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Vec2<T>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T: Sub<T, Output = T>> Sub<Vec2<T>> for Rect<T>

Source§

type Output = Rect<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Vec2<T>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T: Copy + SubAssign<T>> SubAssign<&Vec2<T>> for Rect<T>

Source§

fn sub_assign(&mut self, rhs: &Vec2<T>)

Performs the -= operation. Read more
Source§

impl<T: SubAssign<T>> SubAssign<Vec2<T>> for Rect<T>

Source§

fn sub_assign(&mut self, rhs: Vec2<T>)

Performs the -= operation. Read more
Source§

impl<T> UlpsEq for Rect<T>
where T: UlpsEq, T::Epsilon: Copy,

Source§

fn default_max_ulps() -> u32

The default ULPs to tolerate when testing values that are far-apart. Read more
Source§

fn ulps_eq(&self, other: &Self, epsilon: Self::Epsilon, max_ulps: u32) -> bool

A test for equality that uses units in the last place (ULP) if the values are far apart.
Source§

fn ulps_ne(&self, other: &Rhs, epsilon: Self::Epsilon, max_ulps: u32) -> bool

The inverse of UlpsEq::ulps_eq.
Source§

impl<T: Zeroable> Zeroable for Rect<T>

Source§

fn zeroed() -> Self

Source§

impl<T: Copy> Copy for Rect<T>

Source§

impl<T: Eq> Eq for Rect<T>

Source§

impl<T: Pod> Pod for Rect<T>

Source§

impl<T> StructuralPartialEq for Rect<T>

Auto Trait Implementations§

§

impl<T> Freeze for Rect<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Rect<T>
where T: RefUnwindSafe,

§

impl<T> Send for Rect<T>
where T: Send,

§

impl<T> Sync for Rect<T>
where T: Sync,

§

impl<T> Unpin for Rect<T>
where T: Unpin,

§

impl<T> UnwindSafe for Rect<T>
where T: 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> CheckedBitPattern for T
where T: AnyBitPattern,

Source§

type Bits = T

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
Source§

fn is_valid_bit_pattern(_bits: &T) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
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> 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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.
Source§

impl<T> AnyBitPattern for T
where T: Pod,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> NoUninit for T
where T: Pod,

Source§

impl<T, Rhs> NumAssignOps<Rhs> for T
where T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>,

Source§

impl<T, Rhs, Output> NumOps<Rhs, Output> for T
where T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,