Skip to main content

Bounds

Struct Bounds 

Source
#[repr(C)]
pub struct Bounds<T: Clone + Debug + Default + PartialEq> { pub origin: Point<T>, pub size: Size<T>, }
Expand description

重导出几何类型(Point、Size、Bounds 等) 表示二维空间中的矩形区域,包含原点和尺寸。

Bounds 结构体对类型 T 是泛型的,T 表示坐标系统的类型。 原点表示为 Point<T>,定义矩形的左上角; 尺寸表示为 Size<T>,定义矩形的宽度和高度。

§示例

let origin = Point { x: 0, y: 0 };
let size = Size { width: 10, height: 20 };
let bounds = Bounds::new(origin, size);

assert_eq!(bounds.origin, origin);
assert_eq!(bounds.size, size);

Fields§

§origin: Point<T>

该区域的原点。

§size: Size<T>

矩形的尺寸。

Implementations§

Source§

impl Bounds<Pixels>

Source

pub fn centered( display_id: Option<DisplayId>, size: Size<Pixels>, cx: &App, ) -> Self

为给定显示器或主显示器(未指定时)生成居中的 bounds

Source

pub fn maximized(display_id: Option<DisplayId>, cx: &App) -> Self

为给定显示器或主显示器(未指定时)生成最大化的 bounds

Source§

impl<T> Bounds<T>
where T: Clone + Debug + Default + PartialEq,

Source

pub fn new(origin: Point<T>, size: Size<T>) -> Self

使用指定的原点和尺寸创建一个新的 Bounds。

§参数
  • origin - 表示 bounds 原点的 Point<T>。
  • size - 表示 bounds 尺寸的 Size<T>。
§返回值

返回具有给定原点和尺寸的 Bounds<T>。

Source§

impl<T> Bounds<T>
where T: Sub<Output = T> + Clone + Debug + Default + PartialEq,

Source

pub fn from_corners(top_left: Point<T>, bottom_right: Point<T>) -> Self

从两个角点构造 Bounds:左上角和右下角。

此函数根据提供的角点计算 Bounds 的原点和尺寸。 原点设为左上角,尺寸由右下角和左上角的 x、y 坐标差值确定。

§参数
  • top_left - 表示矩形左上角的 Point<T>。
  • bottom_right - 表示矩形右下角的 Point<T>。
§返回值

返回包含两个角点定义区域的 Bounds<T>。

§示例
let top_left = Point { x: 0, y: 0 };
let bottom_right = Point { x: 10, y: 10 };
let bounds = Bounds::from_corners(top_left, bottom_right);

assert_eq!(bounds.origin, top_left);
assert_eq!(bounds.size.width, 10);
assert_eq!(bounds.size.height, 10);
Source§

impl<T> Bounds<T>
where T: Sub<Output = T> + Half + Clone + Debug + Default + PartialEq,

Source

pub fn from_anchor_and_size( corner: Anchor, origin: Point<T>, size: Size<T>, ) -> Bounds<T>

从角点和尺寸构造 Bounds。指定的角将放置在给定的原点处。

Source§

impl<T> Bounds<T>
where T: Sub<T, Output = T> + Half + Clone + Debug + Default + PartialEq,

Source

pub fn centered_at(center: Point<T>, size: Size<T>) -> Self

创建以给定点为中心的新 bounds。

Source§

impl<T> Bounds<T>
where T: Add<T, Output = T> + Half + Clone + Debug + Default + PartialEq,

Source

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

返回 bounds 的顶部中心点。

Source

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

返回 bounds 的底部中心点。

Source

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

返回 bounds 的左侧中心点。

Source

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

返回 bounds 的右侧中心点。

Source§

impl<T> Bounds<T>
where T: PartialOrd + Add<T, Output = T> + Clone + Debug + Default + PartialEq,

Source

pub fn intersects(&self, other: &Bounds<T>) -> bool

检查此 Bounds 是否与另一个 Bounds 相交。

两个 Bounds 实例相交是指它们在二维空间中存在重叠区域。 此方法检查两个 bounds 之间是否存在任何重叠区域。

§参数
  • other - 要检查相交的另一个 Bounds 的引用。
§返回值

如果两个 bounds 之间存在任何相交则返回 true,否则返回 false。

§示例
let bounds1 = Bounds {
    origin: Point { x: 0, y: 0 },
    size: Size { width: 10, height: 10 },
};
let bounds2 = Bounds {
    origin: Point { x: 5, y: 5 },
    size: Size { width: 10, height: 10 },
};
let bounds3 = Bounds {
    origin: Point { x: 20, y: 20 },
    size: Size { width: 10, height: 10 },
};

assert_eq!(bounds1.intersects(&bounds2), true); // 重叠的 bounds
assert_eq!(bounds1.intersects(&bounds3), false); // 不重叠的 bounds
Source§

impl<T> Bounds<T>
where T: Add<T, Output = T> + Half + Clone + Debug + Default + PartialEq,

Source

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

返回 bounds 的中心点。

通过取原点的 x 和 y 坐标并分别加上 bounds 宽度和高度的一半来计算中心。 中心表示为 Point<T>,其中 T 是坐标系统的类型。

§返回值

表示 bounds 中心的 Point<T>。

§示例
let bounds = Bounds {
    origin: Point { x: 0, y: 0 },
    size: Size { width: 10, height: 20 },
};
let center = bounds.center();
assert_eq!(center, Point { x: 5, y: 10 });
Source§

impl<T> Bounds<T>
where T: Add<T, Output = T> + Clone + Debug + Default + PartialEq,

Source

pub fn half_perimeter(&self) -> T

计算矩形的半周长。

半周长计算为矩形宽度和高度之和。 此方法对类型 T 是泛型的,T 必须实现 Sub trait(用于从 bounds 的原点和尺寸计算宽度和高度) 以及 Add trait(用于将宽度和高度相加得到半周长)。

§示例
let bounds = Bounds {
    origin: Point { x: 0, y: 0 },
    size: Size { width: 10, height: 20 },
};
let half_perimeter = bounds.half_perimeter();
assert_eq!(half_perimeter, 30);
Source§

impl<T> Bounds<T>
where T: Add<T, Output = T> + Sub<Output = T> + Clone + Debug + Default + PartialEq,

Source

pub fn dilate(&self, amount: T) -> Bounds<T>

在所有方向上按指定量膨胀 bounds。

此方法按给定的 amount 扩展 bounds,增大尺寸并调整原点, 使 bounds 在所有方向上均匀向外扩展。 结果 bounds 的宽度和高度将增加 amount 的两倍(因为在两个方向上都扩展), 原点将在 x 和 y 方向上各移动 -amount。

§参数
  • amount - 膨胀 bounds 的量。
§示例
let mut bounds = Bounds {
    origin: Point { x: 10, y: 10 },
    size: Size { width: 10, height: 10 },
};
let expanded_bounds = bounds.dilate(5);
assert_eq!(expanded_bounds, Bounds {
    origin: Point { x: 5, y: 5 },
    size: Size { width: 20, height: 20 },
});
Source

pub fn extend(&self, amount: Edges<T>) -> Bounds<T>

在每个方向上按不同量扩展 bounds。

Source§

impl<T> Bounds<T>
where T: Add<T, Output = T> + Sub<T, Output = T> + Neg<Output = T> + Clone + Debug + Default + PartialEq,

Source

pub fn inset(&self, amount: T) -> Self

按指定量内缩 bounds。等同于 dilate 取负值。

注意:如果 T 不支持负值,此方法可能会 panic。

Source§

impl<T: PartialOrd + Add<T, Output = T> + Sub<Output = T> + Clone + Debug + Default + PartialEq> Bounds<T>

Source

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

计算两个 Bounds 对象的交集。

此方法计算两个 Bounds 的重叠区域。如果 bounds 不相交, 结果 Bounds 的宽度和高度将为零。

§参数
  • other - 要与之相交的另一个 Bounds 的引用。
§返回值

返回表示相交区域的 Bounds。如果没有相交, 返回的 Bounds 的宽度和高度将为零。

§示例
let bounds1 = Bounds {
    origin: Point { x: 0, y: 0 },
    size: Size { width: 10, height: 10 },
};
let bounds2 = Bounds {
    origin: Point { x: 5, y: 5 },
    size: Size { width: 10, height: 10 },
};
let intersection = bounds1.intersect(&bounds2);

assert_eq!(intersection, Bounds {
    origin: Point { x: 5, y: 5 },
    size: Size { width: 5, height: 5 },
});
Source

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

计算两个 Bounds 的并集。

此方法计算包含当前 Bounds 和 other Bounds 的最小 Bounds。 结果 Bounds 的原点将是两个 Bounds 原点的最小值, 尺寸将包含两个 Bounds 的最远边界。

§参数
  • other - 要与之创建并集的另一个 Bounds 的引用。
§返回值

返回表示两个 Bounds 并集的 Bounds。

§示例
let bounds1 = Bounds {
    origin: Point { x: 0, y: 0 },
    size: Size { width: 10, height: 10 },
};
let bounds2 = Bounds {
    origin: Point { x: 5, y: 5 },
    size: Size { width: 15, height: 15 },
};
let union_bounds = bounds1.union(&bounds2);

assert_eq!(union_bounds, Bounds {
    origin: Point { x: 0, y: 0 },
    size: Size { width: 20, height: 20 },
});
Source§

impl<T> Bounds<T>
where T: Add<T, Output = T> + Sub<T, Output = T> + Clone + Debug + Default + PartialEq,

Source

pub fn space_within(&self, outer: &Self) -> Edges<T>

计算外部 bounds 内的可用空间。

Source§

impl<T> Bounds<T>
where T: Add<T, Output = T> + Clone + Debug + Default + PartialEq,

Source

pub fn top(&self) -> T

返回 bounds 的上边缘。

§返回值

类型为 T 的值,表示 bounds 上边缘的 y 坐标。

Source

pub fn bottom(&self) -> T

返回 bounds 的下边缘。

§返回值

类型为 T 的值,表示 bounds 下边缘的 y 坐标。

Source

pub fn left(&self) -> T

返回 bounds 的左边缘。

§返回值

类型为 T 的值,表示 bounds 左边缘的 x 坐标。

Source

pub fn right(&self) -> T

返回 bounds 的右边缘。

§返回值

类型为 T 的值,表示 bounds 右边缘的 x 坐标。

Source

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

返回 bounds 的右上角点。

§返回值

表示 bounds 右上角的 Point<T>。

§示例
let bounds = Bounds {
    origin: Point { x: 0, y: 0 },
    size: Size { width: 10, height: 20 },
};
let top_right = bounds.top_right();
assert_eq!(top_right, Point { x: 10, y: 0 });
Source

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

返回 bounds 的右下角点。

§返回值

表示 bounds 右下角的 Point<T>。

§示例
let bounds = Bounds {
    origin: Point { x: 0, y: 0 },
    size: Size { width: 10, height: 20 },
};
let bottom_right = bounds.bottom_right();
assert_eq!(bottom_right, Point { x: 10, y: 20 });
Source

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

返回 bounds 的左下角点。

§返回值

表示 bounds 左下角的 Point<T>。

§示例
let bounds = Bounds {
    origin: Point { x: 0, y: 0 },
    size: Size { width: 10, height: 20 },
};
let bottom_left = bounds.bottom_left();
assert_eq!(bottom_left, Point { x: 0, y: 20 });
Source§

impl<T> Bounds<T>
where T: Add<T, Output = T> + Half + Clone + Debug + Default + PartialEq,

Source

pub fn corner(&self, corner: Anchor) -> Point<T>

返回请求的角点。

§返回值

表示参数请求的 bounds 角点的 Point<T>。

§示例
use rgpui::{Bounds, Anchor, Point, Size};
let bounds = Bounds {
    origin: Point { x: 0, y: 0 },
    size: Size { width: 10, height: 20 },
};
let bottom_left = bounds.corner(Anchor::BottomLeft);
assert_eq!(bottom_left, Point { x: 0, y: 20 });
Source§

impl<T> Bounds<T>
where T: Add<T, Output = T> + PartialOrd + Clone + Debug + Default + PartialEq,

Source

pub fn contains(&self, point: &Point<T>) -> bool

检查给定的点是否在 bounds 内。

此方法判断一个点是否位于 bounds 定义的矩形内(包括边界)。 如果点的 x 坐标大于等于左边缘且小于等于右边缘, y 坐标大于等于上边缘且小于等于下边缘,则认为该点在内部。

§参数
  • point - 要检查的 Point<T> 的引用。
§返回值

如果点在 bounds 内则返回 true,否则返回 false。

§示例
let bounds = Bounds {
    origin: Point { x: 0, y: 0 },
    size: Size { width: 10, height: 10 },
};
let inside_point = Point { x: 5, y: 5 };
let outside_point = Point { x: 15, y: 15 };

assert!(bounds.contains(&inside_point));
assert!(!bounds.contains(&outside_point));
Source

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

检查此 bounds 是否完全包含在另一个 bounds 内。

此方法判断当前 bounds 是否完全被给定的 bounds 包围。 如果 bounds 的原点(左上角)和右下角都包含在另一个 bounds 内, 则认为此 bounds 被包含在另一个 bounds 内。

§参数
  • other - 可能包含此 bounds 的另一个 Bounds 的引用。
§返回值

如果此 bounds 完全在另一个 bounds 内则返回 true,否则返回 false。

§示例
let outer_bounds = Bounds {
    origin: Point { x: 0, y: 0 },
    size: Size { width: 20, height: 20 },
};
let inner_bounds = Bounds {
    origin: Point { x: 5, y: 5 },
    size: Size { width: 10, height: 10 },
};
let overlapping_bounds = Bounds {
    origin: Point { x: 15, y: 15 },
    size: Size { width: 10, height: 10 },
};

assert!(inner_bounds.is_contained_within(&outer_bounds));
assert!(!overlapping_bounds.is_contained_within(&outer_bounds));
Source

pub fn map<U>(&self, f: impl Fn(T) -> U) -> Bounds<U>
where U: Clone + Debug + Default + PartialEq,

对 bounds 的原点和尺寸应用函数,生成新的 Bounds<U>。

此方法允许通过指定闭包将 Bounds<T> 转换为 Bounds<U>,闭包定义了两种类型之间的转换方式。 闭包应用于 origin 和 size 字段,生成所需类型的新 bounds。

§参数
  • f - 接受类型 T 的值并返回类型 U 的值的闭包。
§返回值

返回原点和尺寸通过给定函数映射后的新 Bounds<U>。

§示例
let bounds = Bounds {
    origin: Point { x: 10.0, y: 10.0 },
    size: Size { width: 10.0, height: 20.0 },
};
let new_bounds = bounds.map(|value| value as f64 * 1.5);

assert_eq!(new_bounds, Bounds {
    origin: Point { x: 15.0, y: 15.0 },
    size: Size { width: 15.0, height: 30.0 },
});
Source

pub fn map_origin(self, f: impl Fn(T) -> T) -> Bounds<T>

对 bounds 的原点应用函数,生成具有新原点的新 Bounds

§示例
let bounds = Bounds {
    origin: Point { x: 10.0, y: 10.0 },
    size: Size { width: 10.0, height: 20.0 },
};
let new_bounds = bounds.map_origin(|value| value * 1.5);

assert_eq!(new_bounds, Bounds {
    origin: Point { x: 15.0, y: 15.0 },
    size: Size { width: 10.0, height: 20.0 },
});
Source

pub fn map_size(self, f: impl Fn(T) -> T) -> Bounds<T>

对 bounds 的尺寸应用函数,生成具有新尺寸的新 Bounds

§示例
let bounds = Bounds {
    origin: Point { x: 10.0, y: 10.0 },
    size: Size { width: 10.0, height: 20.0 },
};
let new_bounds = bounds.map_size(|value| value * 1.5);

assert_eq!(new_bounds, Bounds {
    origin: Point { x: 10.0, y: 10.0 },
    size: Size { width: 15.0, height: 30.0 },
});
Source§

impl<T> Bounds<T>
where T: Add<T, Output = T> + Sub<T, Output = T> + PartialOrd + Clone + Debug + Default + PartialEq,

Source

pub fn localize(&self, point: &Point<T>) -> Option<Point<T>>

将点转换为此 Bounds 定义的坐标空间

Source§

impl<T: PartialOrd + Clone + Debug + Default + PartialEq> Bounds<T>

检查 bounds 是否表示空区域。

§返回值

如果 bounds 的宽度或高度小于或等于零则返回 true,表示空区域。

Source

pub fn is_empty(&self) -> bool

检查 bounds 是否表示空区域。

§返回值

如果 bounds 的宽度或高度小于或等于零则返回 true,表示空区域。

Source§

impl Bounds<Pixels>

Source

pub fn scale(&self, factor: f32) -> Bounds<ScaledPixels>

按给定因子缩放 bounds,通常用于调整显示缩放。

此方法将 bounds 的原点和尺寸乘以提供的缩放因子, 生成一个新的 Bounds<ScaledPixels>,根据因子按比例放大或缩小。 这可用于确保 bounds 在不同显示密度下正确缩放。

§参数
  • factor - 应用于原点和尺寸的缩放因子,通常是显示器的缩放因子。
§返回值

返回表示缩放后 bounds 的新 Bounds<ScaledPixels>。

§示例
let bounds = Bounds {
    origin: Point { x: Pixels::from(10.0), y: Pixels::from(20.0) },
    size: Size { width: Pixels::from(30.0), height: Pixels::from(40.0) },
};
let display_scale_factor = 2.0;
let scaled_bounds = bounds.scale(display_scale_factor);
assert_eq!(scaled_bounds, Bounds {
    origin: Point {
        x: ScaledPixels::from(20.0),
        y: ScaledPixels::from(40.0),
    },
    size: Size {
        width: ScaledPixels::from(60.0),
        height: ScaledPixels::from(80.0)
    },
});
Source

pub fn to_device_pixels(self, factor: f32) -> Bounds<DevicePixels>

将 bounds 从逻辑像素转换为物理像素

Source§

impl Bounds<DevicePixels>

Source

pub fn to_pixels(self, scale_factor: f32) -> Bounds<Pixels>

将 bounds 从物理像素转换为逻辑像素

Trait Implementations§

Source§

impl<T> Add<Point<T>> for Bounds<T>
where T: Add<T, Output = T> + Clone + Debug + Default + PartialEq,

Source§

type Output = Bounds<T>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<T: Clone + Clone + Debug + Default + PartialEq> Clone for Bounds<T>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<T: Copy + Clone + Debug + Default + PartialEq> Copy for Bounds<T>

Source§

impl<T: Debug + Clone + Debug + Default + PartialEq> Debug for Bounds<T>

Source§

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

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

impl<T: Default + Clone + Debug + Default + PartialEq> Default for Bounds<T>

Source§

fn default() -> Self

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

impl<'de, T> Deserialize<'de> for Bounds<T>
where T: Deserialize<'de> + Clone + Debug + Default + PartialEq,

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: Clone + Debug + Default + PartialEq + Display + Add<T, Output = T>> Display for Bounds<T>

Source§

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

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

impl<T, S> Div<S> for Bounds<T>
where Size<T>: Div<S, Output = Size<T>>, T: Div<S, Output = T> + Clone + Debug + Default + PartialEq, S: Clone,

Source§

type Output = Bounds<T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: S) -> Self

Performs the / operation. Read more
Source§

impl<T: Eq + Clone + Debug + Default + PartialEq> Eq for Bounds<T>

Source§

impl<T: Clone + Debug + Default + PartialEq> From<BoundsRefinement<T>> for Bounds<T>
where Option<Point<T>>: Clone, Option<Size<T>>: Clone,

Source§

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

Converts to this type from the input type.
Source§

impl<T: Hash + Clone + Debug + Default + PartialEq> Hash for Bounds<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: IsZero + Clone + Debug + Default + PartialEq> IsZero for Bounds<T>

Source§

fn is_zero(&self) -> bool

确定值是否为零。 Read more
Source§

impl<T, Rhs> Mul<Rhs> for Bounds<T>
where T: Mul<Rhs, Output = Rhs> + Clone + Debug + Default + PartialEq, Point<T>: Mul<Rhs, Output = Point<Rhs>>, Rhs: Clone + Debug + Default + PartialEq,

Source§

type Output = Bounds<Rhs>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl<T, S> MulAssign<S> for Bounds<T>
where T: Mul<S, Output = T> + Clone + Debug + Default + PartialEq, S: Clone,

Source§

fn mul_assign(&mut self, rhs: S)

Performs the *= operation. Read more
Source§

impl<T: PartialEq + Clone + Debug + Default + PartialEq> PartialEq for Bounds<T>

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl<T: Clone + Debug + Default + PartialEq> Refineable for Bounds<T>
where Option<Point<T>>: Clone, Option<Size<T>>: Clone,

Source§

type Refinement = BoundsRefinement<T>

Source§

fn refine(&mut self, refinement: &Self::Refinement)

将给定细化应用到此实例,就地修改。 Read more
Source§

fn refined(self, refinement: Self::Refinement) -> Self

返回应用了细化的新实例,等价于克隆 self 并在其上调用 refine
Source§

fn is_superset_of(&self, refinement: &Self::Refinement) -> bool

如果此实例包含细化中的所有值,则返回 true Read more
Source§

fn subtract(&self, refinement: &Self::Refinement) -> Self::Refinement

返回表示此实例与给定细化之间差异的细化 Read more
Source§

fn from_cascade(cascade: &Cascade<Self>) -> Self
where Self: Default + Sized,

通过将所有细化合并到默认值之上来从级联创建实例
Source§

impl<T> Serialize for Bounds<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: PartialEq + Clone + Debug + Default + PartialEq> StructuralPartialEq for Bounds<T>

Source§

impl<T> Sub<Point<T>> for Bounds<T>
where T: Sub<T, Output = T> + Clone + Debug + Default + PartialEq,

Source§

type Output = Bounds<T>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more

Auto Trait Implementations§

§

impl<T> Forget for Bounds<T>

§

impl<T> Freeze for Bounds<T>
where Point<T>: Freeze, Size<T>: Freeze,

§

impl<T> Move for Bounds<T>

§

impl<T> RefUnwindSafe for Bounds<T>

§

impl<T> Send for Bounds<T>
where Point<T>: Send, Size<T>: Send,

§

impl<T> Sync for Bounds<T>
where Point<T>: Sync, Size<T>: Sync,

§

impl<T> Unpin for Bounds<T>
where Point<T>: Unpin, Size<T>: Unpin,

§

impl<T> UnsafeUnpin for Bounds<T>

§

impl<T> UnwindSafe for Bounds<T>

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> CustomError for T
where T: Display + Debug + Send + Sync + 'static,

Source§

fn as_any(&self) -> &(dyn Any + Send + Sync + 'static)

Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + Send + Sync + 'static)

Source§

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

Source§

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

Source§

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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> ToSmolStr for T
where T: Display + ?Sized,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more